@Test public void testGetPropertyValues() { FileDefinition def = new FileDefinition( null ); AbstractBlockHolder holder = new BlockFacet( def ); holder.getInnerBlocks().add( new BlockProperty( def, "names", "value1, value2 , value3, value 4 " )); holder.getInnerBlocks().add( new BlockProperty( def, "address", null )); holder.getInnerBlocks().add( new BlockProperty( def, "age", "30" )); holder.getInnerBlocks().add( new BlockProperty( def, "alias", "" )); List<String> values = ModelUtils.getPropertyValues( holder, "names" ); Assert.assertEquals( 4, values.size()); Assert.assertEquals( "value1", values.get( 0 )); Assert.assertEquals( "value2", values.get( 1 )); Assert.assertEquals( "value3", values.get( 2 )); Assert.assertEquals( "value 4", values.get( 3 )); values = ModelUtils.getPropertyValues( holder, "age" ); Assert.assertEquals( 1, values.size()); Assert.assertEquals( "30", values.get( 0 )); values = ModelUtils.getPropertyValues( holder, "alias" ); Assert.assertEquals( 0, values.size()); values = ModelUtils.getPropertyValues( holder, "address" ); Assert.assertEquals( 0, values.size()); values = ModelUtils.getPropertyValues( holder, "oops" ); Assert.assertEquals( 0, values.size()); }
public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; }
ModelUtils { public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; } }
ModelUtils { public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; } private  ModelUtils(); }
ModelUtils { public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; } private  ModelUtils(); static String getPropertyValue( AbstractBlockHolder holder, String propertyName ); static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ); static Map<String,String> getData( AbstractBlockHolder holder ); static Map<String,ExportedVariable> getExportedVariables( AbstractBlockHolder holder ); static Map<String,ExportedVariable> findExportedVariables( String exportedVariablesDecl, File sourceFile, int lineNumber ); }
ModelUtils { public static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ) { List<String> result = new ArrayList<> (); for( BlockProperty p : holder.findPropertiesBlockByName( propertyName )) { result.addAll( Utils.splitNicely( p.getValue(), ParsingConstants.PROPERTY_SEPARATOR )); } return result; } private  ModelUtils(); static String getPropertyValue( AbstractBlockHolder holder, String propertyName ); static List<String> getPropertyValues( AbstractBlockHolder holder, String propertyName ); static Map<String,String> getData( AbstractBlockHolder holder ); static Map<String,ExportedVariable> getExportedVariables( AbstractBlockHolder holder ); static Map<String,ExportedVariable> findExportedVariables( String exportedVariablesDecl, File sourceFile, int lineNumber );  }