@Override public boolean serializeField(JsonSerializerInternal serializer, Object parent, FieldAccess fieldAccess, CharBuf builder) { // It only check parent class equality, doesn't work with inheritance if (parentClass == parent.getClass() && fieldName.equals(fieldAccess.name())) { Object value = fieldAccess.getValue(parent); serialize(serializer, parent, fieldAccess, value, builder); return true; } return false; }
@Override public boolean serializeField(JsonSerializerInternal serializer, Object parent, FieldAccess fieldAccess, CharBuf builder) { // It only check parent class equality, doesn't work with inheritance if (parentClass == parent.getClass() && fieldName.equals(fieldAccess.name())) { Object value = fieldAccess.getValue(parent); serialize(serializer, parent, fieldAccess, value, builder); return true; } return false; }
@Override public boolean serializeField(JsonSerializerInternal serializer, Object parent, FieldAccess fieldAccess, CharBuf builder) { // It only check parent class equality, doesn't work with inheritance if (parentClass == parent.getClass() && fieldName.equals(fieldAccess.name())) { Object value = fieldAccess.getValue(parent); serialize(serializer, parent, fieldAccess, value, builder); return true; } return false; }
private static String getPropertyString(Object root, String[] properties) { Object object = baseForGetProperty(root, properties); Map<String, FieldAccess> fields = getFieldsFromObject( object ); final String lastProperty = properties[ properties.length - 1 ]; FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.string ) { return (String) field.getObject( object ); } else { return Conversions.toString(field.getValue(object)); } }
private static String getPropertyString(Object root, String[] properties) { Object object = baseForGetProperty(root, properties); Map<String, FieldAccess> fields = getFieldsFromObject( object ); final String lastProperty = properties[ properties.length - 1 ]; FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.string ) { return (String) field.getObject( object ); } else { return Conversions.toString(field.getValue(object)); } }
public static float getPropertyFloat( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toFloat(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.flt ) { return field.getFloat( object ); } else { return Conversions.toFloat( field.getValue( object ) ); } }
public static float getPropertyFloat( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toFloat(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.flt ) { return field.getFloat( object ); } else { return Conversions.toFloat( field.getValue( object ) ); } }
public static int getPropertyInt( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toInt(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject(object); FieldAccess field = fields.get(lastProperty); if ( field.type() == Typ.intgr ) { return field.getInt( object ); } else { return Conversions.toInt(field.getValue(object)); } }
public static int getPropertyInt( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toInt(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject(object); FieldAccess field = fields.get(lastProperty); if ( field.type() == Typ.intgr ) { return field.getInt( object ); } else { return Conversions.toInt(field.getValue(object)); } }
public static char getPropertyChar( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toChar(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.chr ) { return field.getChar( object ); } else { return Conversions.toChar( field.getValue( object ) ); } }
public static char getPropertyChar( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toChar(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.chr ) { return field.getChar( object ); } else { return Conversions.toChar( field.getValue( object ) ); } }
public static double getPropertyDouble( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toDouble(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.dbl ) { return field.getDouble( object ); } else { return Conversions.toDouble( field.getValue( object ) ); } }
public static long getPropertyLong( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toLong(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.lng ) { return field.getLong( object ); } else { return Conversions.toLong( field.getValue( object ) ); } }
public static long getPropertyLong( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toLong(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.lng ) { return field.getLong( object ); } else { return Conversions.toLong( field.getValue( object ) ); } }
public static short getPropertyShort( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toShort(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.shrt ) { return field.getShort( object ); } else { return Conversions.toShort( field.getValue( object ) ); } }
public static double getPropertyDouble( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toDouble(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.dbl ) { return field.getDouble( object ); } else { return Conversions.toDouble( field.getValue( object ) ); } }
public static boolean getPropertyBoolean( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toBoolean(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.bln ) { return field.getBoolean( object ); } else { return Conversions.toBoolean( field.getValue( object ) ); } }
public static short getPropertyShort( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toShort(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.shrt ) { return field.getShort( object ); } else { return Conversions.toShort( field.getValue( object ) ); } }
public static boolean getPropertyBoolean( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toBoolean(getPropertyValue(root, properties)); } Object object = baseForGetProperty( root, properties ); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.bln ) { return field.getBoolean( object ); } else { return Conversions.toBoolean( field.getValue( object ) ); } }
/** * @param root root * @param properties properties forming a path * @return byte */ public static byte getPropertyByte( final Object root, final String... properties ) { final String lastProperty = properties[ properties.length - 1 ]; if ( isDigits( lastProperty ) ) { return Conversions.toByte(getPropertyValue(root, properties)); } Object object = baseForGetProperty(root, properties); Map<String, FieldAccess> fields = getFieldsFromObject( object ); FieldAccess field = fields.get( lastProperty ); if ( field.type() == Typ.bt ) { return field.getByte( object ); } else { return Conversions.toByte(field.getValue(object)); } }