Package org.springframework.util.ReflectionUtils

Examples of org.springframework.util.ReflectionUtils.FieldCallback


        if (modelAssociation != null) {
          associations.add(modelAssociation);
        }
      }

      ReflectionUtils.doWithFields(clazz, new FieldCallback() {

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


    }

    /**
     * Looks for Hibernate properties and set them all.
     */
    ReflectionUtils.doWithFields(AvailableSettings.class, new FieldCallback() {
      @Override
      public void doWith(final Field field) throws IllegalAccessException {
        String propertyName = (String) field.get(null);
        String propertyValue = env.getProperty(propertyName);
        if (!StringUtils.isEmpty(propertyValue)) {
View Full Code Here

    expect(env.getRequiredProperty(DataSources.DATABASE)).andReturn("mem");
    expect(env.getRequiredProperty("application.ns", String[].class)).andReturn(
        new String[]{JpaModuleTest.class.getPackage().getName() });
    expect(env.getProperty(JpaModule.DB_SCHEMA, "update")).andReturn(mode);

    ReflectionUtils.doWithFields(AvailableSettings.class, new FieldCallback() {
      @Override
      public void doWith(final Field field) throws IllegalArgumentException,
          IllegalAccessException {
        String propertyName = (String) field.get(null);
        expect(env.getProperty(propertyName)).andReturn(null);
View Full Code Here

    expect(env.getRequiredProperty(DataSources.DATABASE)).andReturn("jdbc:mysql://local");
    expect(env.getRequiredProperty("application.ns", String[].class)).andReturn(
        new String[]{JpaModuleTest.class.getPackage().getName() });
    expect(env.getProperty(JpaModule.DB_SCHEMA, "update")).andReturn(mode);

    ReflectionUtils.doWithFields(AvailableSettings.class, new FieldCallback() {
      @Override
      public void doWith(final Field field) throws IllegalArgumentException,
          IllegalAccessException {
        String propertyName = (String) field.get(null);
        expect(env.getProperty(propertyName)).andReturn(null);
View Full Code Here

*/
public abstract class TestUtils {

  public static Object getFieldValue(final Object object, final String fieldName) {
    final Object[] fld = new Object[1];
    ReflectionUtils.doWithFields(object.getClass(), new FieldCallback() {

      public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
        field.setAccessible(true);
        fld[0] = field.get(object);
      }
View Full Code Here

  }

  protected Object getPrivateProperty(final Object target, final String fieldName) {
    final Field foundField[] = new Field[1];

    ReflectionUtils.doWithFields(target.getClass(), new FieldCallback() {

      public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
        field.setAccessible(true);
        foundField[0] = field;
      }
View Full Code Here

    }

    // fallback to field inspection (KF and Prosyst)
    final BundleContext[] ctx = new BundleContext[1];

    ReflectionUtils.doWithFields(bundle.getClass(), new FieldCallback() {

      public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException {
        ReflectionUtils.makeAccessible(field);
        ctx[0] = (BundleContext) field.get(bundle);
      }
View Full Code Here

    }

    // fallback to field inspection (KF and Prosyst)
    final BundleContext[] ctx = new BundleContext[1];

    ReflectionUtils.doWithFields(bundle.getClass(), new FieldCallback() {

      public void doWith(final Field field) throws IllegalArgumentException, IllegalAccessException {
        ReflectionUtils.makeAccessible(field);
        ctx[0] = (BundleContext) field.get(bundle);
      }
View Full Code Here

    final String execName = "make-sure-exec-passed-in";
    exec.setBeanName(execName);
    exec.afterPropertiesSet();
    connectionFactory.setExecutor(exec);
    final Field[] fields = new Field[1];
    ReflectionUtils.doWithFields(RabbitTemplate.class, new FieldCallback() {
      @Override
      public void doWith(Field field) throws IllegalArgumentException,
          IllegalAccessException {
        field.setAccessible(true);
        fields[0] = field;
View Full Code Here

TOP

Related Classes of org.springframework.util.ReflectionUtils.FieldCallback

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.