Examples of FieldCallback


Examples of org.springframework.util.ReflectionUtils.FieldCallback

        if (modelValidation != null) {
          model.addValidation(modelValidation);
        }
      }

      ReflectionUtils.doWithFields(clazz, new FieldCallback() {

        @Override
        public void doWith(Field field) throws IllegalArgumentException,
            IllegalAccessException {
          if (!fields.contains(field.getName())
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

    }

    final List<ModelFieldBean> modelFields = new ArrayList<ModelFieldBean>();
    final List<AbstractAssociation> associations = new ArrayList<AbstractAssociation>();

    ReflectionUtils.doWithFields(clazz, new FieldCallback() {
      private final Set<String> fields = new HashSet<String>();

      @Override
      public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
        if (!fields.contains(field.getName())
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

        if (modelValidation != null) {
          model.addValidation(modelValidation);
        }
      }

      ReflectionUtils.doWithFields(clazz, new FieldCallback() {

        @Override
        public void doWith(Field field)
            throws IllegalArgumentException, IllegalAccessException {
          if (!fields.contains(field.getName())
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

                    .next()).build();
            description = WSDLFactory.newInstance().newWSDLWriter().getDocument(definition);
        } catch (WSDLException e) {
            throw new DeploymentException(e);
        }
        ReflectionUtils.doWithFields(getPojo().getClass(), new FieldCallback() {
            public void doWith(Field field) throws IllegalArgumentException,
                    IllegalAccessException {
                if (field.getAnnotation(WebServiceRef.class) != null) {
                    ServiceImpl s = new ServiceImpl(getBus(), null, null, field
                            .getType());
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

         
        }
      });
    } else {

      ReflectionUtils.doWithFields(clazz, new FieldCallback() {
        private final Set<String> fields = new HashSet<String>();

        @Override
        public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
          if (!fields.contains(field.getName())
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

    }

    @Test
    public void testResolveScopesCoverage() {
        final Map<String, Integer> knownScopes = new TreeMap<String, Integer>();
        ReflectionUtils.doWithFields(SearchControls.class, new FieldCallback() {
            public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
                int mod = field.getModifiers();
                if (Modifier.isPublic(mod)
                        && Modifier.isStatic(mod)
                        && Modifier.isFinal(mod)) {
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

        return staticFetchers.containsKey(name)
                || instanceFetchers.containsKey(name);
    }

    private void init() {
        FieldCallback fieldCallback = new ReflectionUtils.FieldCallback() {
            public void doWith(Field field) {
                if (field.isSynthetic()) {
                    return;
                }
                final int modifiers = field.getModifiers();
                if (!Modifier.isPublic(modifiers)) {
                    return;
                }

                final String name = field.getName();
                if (name.indexOf('$') == -1) {
                    boolean staticField = Modifier.isStatic(modifiers);
                    if (staticField) {
                        staticFetchers.put(name, new FieldReaderFetcher(field,
                                staticField));
                    } else {
                        instanceFetchers.put(name, new FieldReaderFetcher(
                                field, staticField));
                    }
                }
            }
        };

        MethodCallback methodCallback = new ReflectionUtils.MethodCallback() {
            public void doWith(Method method) throws IllegalArgumentException,
                    IllegalAccessException {
                if (method.isSynthetic()) {
                    return;
                }
                if (!Modifier.isPublic(method.getModifiers())) {
                    return;
                }
                if (Modifier.isStatic(method.getModifiers())
                        && method.getReturnType() != Void.class) {
                    if (method.getParameterTypes().length == 0) {
                        String name = method.getName();
                        if (name.indexOf('$') == -1) {
                            if (name.length() > 3 && name.startsWith("get")
                                    && Character.isUpperCase(name.charAt(3))) {
                                name = name.substring(3);
                            } else if (name.length() > 2
                                    && name.startsWith("is")
                                    && Character.isUpperCase(name.charAt(2))
                                    && (method.getReturnType() == Boolean.class ||
                                        method.getReturnType() == boolean.class)) {
                                name = name.substring(2);
                            }
                            PropertyFetcher fetcher = new GetterPropertyFetcher(
                                    method, true);
                            staticFetchers.put(name, fetcher);
                            staticFetchers.put(StringUtils.uncapitalize(name), fetcher);
                        }
                    }
                }
            }
        };

        List<Class<?>> allClasses = resolveAllClasses(clazz);
        for (Class<?> c : allClasses) {
            Field[] fields = c.getDeclaredFields();
            for (Field field : fields) {
                try {
                    fieldCallback.doWith(field);
                } catch (IllegalAccessException ex) {
                    throw new IllegalStateException(
                            "Shouldn't be illegal to access field '"
                                    + field.getName() + "': " + ex);
                }
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

    /**
     * {@inheritDoc}
     */
    public Object postProcessBeforeInitialization(final Object bean, String beanName)
            throws BeansException {
        ReflectionUtils.doWithFields(bean.getClass(), new FieldCallback() {
            @SuppressWarnings("unchecked")
            public void doWith(Field field) throws IllegalArgumentException,
                    IllegalAccessException {
                ReflectionUtils.makeAccessible(field);
                if (field.getAnnotation(AutowiredLogger.class) != null) {
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

      }
    }

    final List<ModelFieldBean> modelFields = new ArrayList<ModelFieldBean>();

    ReflectionUtils.doWithFields(clazz, new FieldCallback() {
      private final Set<String> fields = new HashSet<String>();

      @Override
      public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
        if ((Modifier.isPublic(field.getModifiers()) || hasReadMethod.contains(field.getName()))
View Full Code Here

Examples of org.springframework.util.ReflectionUtils.FieldCallback

        if (modelValidation != null) {
          model.addValidation(modelValidation);
        }
      }

      ReflectionUtils.doWithFields(clazz, new FieldCallback() {

        @Override
        public void doWith(Field field) throws IllegalArgumentException,
            IllegalAccessException {
          if (!fields.contains(field.getName())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.