/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(final Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the * class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls * which should be defined in class definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(final Class cls, final String name, final Class definedIn) { final Map fields = buildMap(cls, definedIn != null); final Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, -1) : (Object)name); return field; }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(final Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(final Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(final Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator<Field> fieldsFor(final Class<?> cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(final Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(final Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Returns an iterator for all fields for some class * * @param cls the class you are interested on * @return an iterator for its fields */ public Iterator fieldsFor(Class cls) { return buildMap(cls, true).values().iterator(); }
/** * Works like {@link #field(Class, String, Class)} but returns null instead of throwing exception. */ public Field fieldOrNull(Class cls, String name, Class definedIn) { Map fields = buildMap(cls, definedIn != null); Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey( name, definedIn, 0) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the * class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls * which should be defined in class definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(final Class<?> cls, final String name, final Class<?> definedIn) { final Map<?, Field> fields = buildMap(cls, definedIn != null); final Field field = fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, -1) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the * class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls * which should be defined in class definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(final Class cls, final String name, final Class definedIn) { final Map fields = buildMap(cls, definedIn != null); final Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, -1) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field * named 'name' inside the class cls. If definedIn is different than null, tries to find the * specified field name in the specified class cls which should be defined in class * definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(Class cls, String name, Class definedIn) { Map fields = buildMap(cls, definedIn != null); Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, -1) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field * named 'name' inside the class cls. If definedIn is different than null, tries to find the * specified field name in the specified class cls which should be defined in class * definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(Class cls, String name, Class definedIn) { Map fields = buildMap(cls, definedIn != null); Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, 0) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the * class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls * which should be defined in class definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(final Class cls, final String name, final Class definedIn) { final Map fields = buildMap(cls, definedIn != null); final Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, -1) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field named 'name' inside the * class cls. If definedIn is different than null, tries to find the specified field name in the specified class cls * which should be defined in class definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself or <code>null</code> * @since 1.4 */ public Field fieldOrNull(final Class cls, final String name, final Class definedIn) { final Map fields = buildMap(cls, definedIn != null); final Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey(name, definedIn, -1) : (Object)name); return field; }
/** * Returns an specific field of some class. If definedIn is null, it searches for the field * named 'name' inside the class cls. If definedIn is different than null, tries to find the * specified field name in the specified class cls which should be defined in class * definedIn (either equals cls or a one of it's superclasses) * * @param cls the class where the field is to be searched * @param name the field name * @param definedIn the superclass (or the class itself) of cls where the field was defined * @return the field itself */ public Field field(Class cls, String name, Class definedIn) { Map fields = buildMap(cls, definedIn != null); Field field = (Field)fields.get(definedIn != null ? (Object)new FieldKey( name, definedIn, 0) : (Object)name); if (field == null) { throw new ObjectAccessException("No such field " + cls.getName() + "." + name); } else { return field; } }