@Test public void testParseVariableName() { String[][] values = { { "facet", "variable" }, { "FacetName", "complex.variable.name" }, { "facet-Name", "" }, { "", "some_variable" } }; for( String[] value : values ) { String s = value[ 0 ] + "." + value[ 1 ]; Map.Entry<String,String> entry = VariableHelpers.parseVariableName( s ); Assert.assertEquals( "Invalid component or facet name for " + s, value[ 0 ], entry.getKey()); Assert.assertEquals( "Invalid simple name for " + s, value[ 1 ], entry.getValue()); } Map.Entry<String,String> entry = VariableHelpers.parseVariableName( "noPrefix" ); Assert.assertEquals( "noPrefix", entry.getValue()); Assert.assertEquals( "", entry.getKey()); }
public static Map.Entry<String,String> parseVariableName( String variableName ) { String componentOrFacetName = "", simpleName = variableName; int index = variableName.indexOf( '.' ); if( index >= 0 ) { componentOrFacetName = variableName.substring( 0, index ).trim(); simpleName = variableName.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( componentOrFacetName, simpleName ); }
VariableHelpers { public static Map.Entry<String,String> parseVariableName( String variableName ) { String componentOrFacetName = "", simpleName = variableName; int index = variableName.indexOf( '.' ); if( index >= 0 ) { componentOrFacetName = variableName.substring( 0, index ).trim(); simpleName = variableName.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( componentOrFacetName, simpleName ); } }
VariableHelpers { public static Map.Entry<String,String> parseVariableName( String variableName ) { String componentOrFacetName = "", simpleName = variableName; int index = variableName.indexOf( '.' ); if( index >= 0 ) { componentOrFacetName = variableName.substring( 0, index ).trim(); simpleName = variableName.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( componentOrFacetName, simpleName ); } private  VariableHelpers(); }
VariableHelpers { public static Map.Entry<String,String> parseVariableName( String variableName ) { String componentOrFacetName = "", simpleName = variableName; int index = variableName.indexOf( '.' ); if( index >= 0 ) { componentOrFacetName = variableName.substring( 0, index ).trim(); simpleName = variableName.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( componentOrFacetName, simpleName ); } private  VariableHelpers(); static Map.Entry<String,String> parseVariableName( String variableName ); static Map.Entry<String,String> parseExportedVariable( String exportedVariable ); static Map<String,ExportedVariable> parseExportedVariables( String line ); static Set<String> findPrefixesForExportedVariables( Instance instance ); static Set<String> findPrefixesForImportedVariables( Instance instance ); static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ); static Set<String> findPrefixesForExternalImports( AbstractApplication app ); }
VariableHelpers { public static Map.Entry<String,String> parseVariableName( String variableName ) { String componentOrFacetName = "", simpleName = variableName; int index = variableName.indexOf( '.' ); if( index >= 0 ) { componentOrFacetName = variableName.substring( 0, index ).trim(); simpleName = variableName.substring( index + 1 ).trim(); } return new AbstractMap.SimpleEntry<>( componentOrFacetName, simpleName ); } private  VariableHelpers(); static Map.Entry<String,String> parseVariableName( String variableName ); static Map.Entry<String,String> parseExportedVariable( String exportedVariable ); static Map<String,ExportedVariable> parseExportedVariables( String line ); static Set<String> findPrefixesForExportedVariables( Instance instance ); static Set<String> findPrefixesForImportedVariables( Instance instance ); static Set<String> findPrefixesForMandatoryImportedVariables( Instance instance ); static Set<String> findPrefixesForExternalImports( AbstractApplication app );  }