Example usage for java.lang.reflect Field.Name getType

List of usage examples for java.lang.reflect Field.Name getType

Introduction

In this page you can find the example usage for java.lang.reflect Field.Name getType.

Prototype

public Class<?> getType() 

Source Link

Document

Returns a Class object that identifies the declared type for the field represented by this Field object.

Usage

From source file:gr.abiss.calipso.domain.AbstractItem.java

public void setValue(Field.Name fieldName, Object value) {
    if (fieldName.getType() != 200) {
        try {//w w w  . j a  v a  2  s. c  o m
            PropertyUtils.setProperty(this, fieldName.getText(), value);
        } catch (Exception e) {
            throw new RuntimeException("Could not set value for custom attribute " + fieldName, e);
        }
    }
}

From source file:gr.abiss.calipso.domain.AbstractItem.java

public Object getValue(Field.Name fieldName) {
    Object valueObject = null;/* ww w .j  a  v  a2  s.c  om*/
    if (fieldName.getType() != 200) {
        try {
            valueObject = PropertyUtils.getProperty(this, fieldName.getText());
            //         switch(fieldName.getType()) {
            //              case 3: return (Integer) valueObject;
            //              case 4: return (Double) valueObject;
            //              case 5: return (String) valueObject;
            //              case 6: return (Date) valueObject;
            //              case 10: return (Organization) valueObject;
            //              case 11: return (File) valueObject;
            //              case 20: return (User) valueObject;
            //              case 25: return (Country) valueObject;
            //              case 100: return (Space) valueObject;
            //         }
        } catch (Exception e) {
            throw new RuntimeException("Could not obtain value for custom attribute " + fieldName, e);
        }
    }
    return valueObject;
}