Code example for Field

Methods: getAnnotation, isAnnotationPresent

0
        } 
        catch (NoSuchFieldException e)
        { 
            throw new FieldNotFoundException("Could not find field " + fieldName + " in " + clazz.getName());
        } 
        if (field.isAnnotationPresent(Transient.class))
        { 
            throw new TransientFieldException(field);
        } 
        if (field.isAnnotationPresent(PrimaryKey.class))
        { 
            return field.getAnnotation(PrimaryKey.class).value();
        } 
        else if (field.isAnnotationPresent(ForeignKey.class))
        { 
            return field.getAnnotation(ForeignKey.class).value();
        } 
        else if (field.isAnnotationPresent(Column.class))
        { 
            return field.getAnnotation(Column.class).value();
        } 
 
        throw new FieldNotFoundException("Could not find database column for field " + fieldName + " in " + clazz.getName());
    }