final StringBuffer optionalProperty ) {
// clear optionalField
optionalProperty.setLength( 0 );
// Parse whether leftField contains subfield or attribute
ScriptableObjectBase o = object;
String optional = "";
String key = fieldName;
if( key.indexOf( '.' ) >= 0 ) {
final StringTokenizer st = new StringTokenizer( key, "." );
while( true ) {
key = st.nextToken();
if( !st.hasMoreTokens() ) {
break;
}
final ScriptField field = o.getItem( key );
if( field == null ) {
return null;
}
if( field.getType() == ScriptField.TYPE_SCRIPTABLE ) {
o = (ScriptableObjectBase) field.getValue();
if( o == null ) {
return null;
}
} else {
// allow other types have sub-property???
optional = st.nextToken();
break;
}
}
}
ScriptField fieldToTest = null;
try {
fieldToTest = o.getItem( key );
} catch( final Exception e ) {
}
optionalProperty.append( optional );
return fieldToTest;