Package org.apache.niolex.commons.reflect.FieldUtil

Examples of org.apache.niolex.commons.reflect.FieldUtil.Filter


     */
    public static final <QT> FieldFilter<QT> forType(final Class<QT> type) {
        // Step 1. Create a new field filter.
        FieldFilter<QT> e = new FieldFilter<QT>();
        // Step 2. Add filter.
        e.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return ClassUtils.isAssignable(f.getType(), type);
            }});
        return e;
View Full Code Here


     */
    public static final <E> FieldFilter<E> exactType(final Class<E> type) {
        // Step 1. Create a new field filter.
        FieldFilter<E> e = new FieldFilter<E>();
        // Step 2. Add filter.
        e.filterList.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return type.equals(f.getType());
            }});
        return e;
View Full Code Here

     * @param fieldName the field name
     * @return this
     */
    public final FieldFilter<FT> withName(final String fieldName) {
        Check.notNull(fieldName, "fieldName should not be null.");
        return this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return fieldName.equals(f.getName());
            }});
    }
View Full Code Here

     * @param nameRegex the field name regex expression
     * @return this
     */
    public final FieldFilter<FT> nameLike(final String nameRegex) {
        final Pattern p = Pattern.compile(nameRegex);
        return this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return p.matcher(f.getName()).matches();
            }});
    }
View Full Code Here

     * Filter the fields with only static fields.
     *
     * @return this
     */
    public final FieldFilter<FT> onlyStatic() {
        return this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return Modifier.isStatic(f.getModifiers());
            }});
    }
View Full Code Here

     * Filter the fields without static fields.
     *
     * @return this
     */
    public final FieldFilter<FT> noStatic() {
        return this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return !Modifier.isStatic(f.getModifiers());
            }});
    }
View Full Code Here

     * Filter the fields without synthetic fields.
     *
     * @return this
     */
    public final FieldFilter<FT> noSynthetic() {
        return this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return !f.isSynthetic();
            }});
    }
View Full Code Here

     * @param type the field type
     * @return a newly created field filter
     */
    public final <E> FieldFilter<? extends E> forType(final Class<E> type) {
        // Step 1. Add filter.
        this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return ClassUtils.isAssignable(f.getType(), type);
            }});
        // Step 2. Create a new field filter.
View Full Code Here

     * @param type the field type
     * @return a newly created field filter
     */
    public final <E> FieldFilter<E> exactType(final Class<E> type) {
        // Step 1. Add filter.
        this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return type.equals(f.getType());
            }});
        // Step 2. Create a new field filter.
View Full Code Here

     *
     * @param fieldName the field name
     * @return this
     */
    public final FieldFilter<T> withName(final String fieldName) {
        return this.add(new Filter(){
            @Override
            public boolean isValid(Field f) {
                return fieldName.equals(f.getName());
            }});
    }
View Full Code Here

TOP

Related Classes of org.apache.niolex.commons.reflect.FieldUtil.Filter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.