protected Object getValue ( String propertyName , Type propertyType , boolean optional , String defaultString ) { Object value = null ; assertNotClosed ( ) ; SourcedValue sourced = getSourcedValue ( propertyName , propertyType ) ; if ( sourced != null ) { value = sourced . getValue ( ) ; } else { if ( optional ) { value = convertValue ( defaultString , propertyType ) ; } else { throw new NoSuchElementException ( Tr . formatMessage ( tc , "no.such.element.CWMCG0015E" , propertyName ) ) ; } } return value ; }
Get the converted value of the given property . If the property is not found and optional is true then use the default string to create a value to return . If the property is not found and optional is false then throw an exception .