From dac1fdd20d1b45de9cd879ee6cb5fc87d2c6d8e2 Mon Sep 17 00:00:00 2001 From: buczekp <buczekp> Date: Mon, 25 Oct 2010 12:21:43 +0000 Subject: [PATCH] [LMS-1845] changed naming convention in adaptors - stripped 'get' from getters SVN: 18428 --- .../calculator/AbstractEntityAdaptor.java | 10 +++++----- .../db/dynamic_property/calculator/IEntityAdaptor.java | 9 ++++----- .../calculator/DynamicPropertyCalculatorTest.java | 6 ++---- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java index 28392e985a0..2b176434132 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/AbstractEntityAdaptor.java @@ -66,23 +66,23 @@ public class AbstractEntityAdaptor implements IEntityAdaptor propertiesByCode.put(property.getPropertyTypeCode(), property); } - public String getCode() + public String code() { return code; } - public IEntityPropertyAdaptor getPropertyByCode(String propertyTypeCode) + public IEntityPropertyAdaptor propertyByCode(String propertyTypeCode) { return propertiesByCode.get(propertyTypeCode); } - public String getPropertyValueByCode(String propertyTypeCode) + public String propertyValueByCode(String propertyTypeCode) { - final IEntityPropertyAdaptor propertyOrNull = getPropertyByCode(propertyTypeCode); + final IEntityPropertyAdaptor propertyOrNull = propertyByCode(propertyTypeCode); return propertyOrNull == null ? "" : propertyOrNull.getValueAsString(); } - public Collection<IEntityPropertyAdaptor> getProperties() + public Collection<IEntityPropertyAdaptor> properties() { return propertiesByCode.values(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/IEntityAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/IEntityAdaptor.java index aa5f2ad5262..de8b0fa14e7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/IEntityAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/IEntityAdaptor.java @@ -25,19 +25,18 @@ import java.util.Collection; * * @author Piotr Buczek */ -// TODO 2010-10-15, Piotr Buczek: what naming convention should be used for DTOs used in Jython public interface IEntityAdaptor { /** Returns the code. */ - public String getCode(); + public String code(); /** Returns the property by code of the property type. */ - public IEntityPropertyAdaptor getPropertyByCode(String propertyTypeCode); + public IEntityPropertyAdaptor propertyByCode(String propertyTypeCode); /** Returns the property value by code of the property type. */ - public String getPropertyValueByCode(String propertyTypeCode); + public String propertyValueByCode(String propertyTypeCode); /** Returns collection of properties of the entity */ - public Collection<IEntityPropertyAdaptor> getProperties(); + public Collection<IEntityPropertyAdaptor> properties(); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java index 2fbdb461d99..650a7f0d217 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/dynamic_property/calculator/DynamicPropertyCalculatorTest.java @@ -22,7 +22,6 @@ import java.util.Collection; import org.testng.AssertJUnit; import org.testng.annotations.Test; - /** * @author Piotr Buczek */ @@ -34,8 +33,7 @@ public class DynamicPropertyCalculatorTest extends AssertJUnit { final String entityCode1 = "ecode1"; final String entityCode2 = "ecode2"; - final DynamicPropertyCalculator calculator = - new DynamicPropertyCalculator("entity.getCode()"); + final DynamicPropertyCalculator calculator = new DynamicPropertyCalculator("entity.code()"); calculator.setEntity(createEntity(entityCode1, null)); assertEquals(entityCode1, calculator.evalAsString()); @@ -48,7 +46,7 @@ public class DynamicPropertyCalculatorTest extends AssertJUnit public void testGetEntityPropertyValue() { final DynamicPropertyCalculator calculator = - new DynamicPropertyCalculator("entity.getPropertyValueByCode('p2')"); + new DynamicPropertyCalculator("entity.propertyValueByCode('p2')"); final String entityCode = "ecode"; -- GitLab