Package de.danielbechler.diff.instantiation

Examples of de.danielbechler.diff.instantiation.TypeInfo


        return String.class;
      }
    });
    when(instances.getWorking()).thenReturn("foo");
    when(instances.getBase()).thenReturn("bar");
    when(typeInfoResolver.typeInfoForNode(any(DiffNode.class))).thenReturn(new TypeInfo(Class.class));

    beanDiffer = new BeanDiffer(differDispatcher, introspectableResolver, returnableResolver, comparisonStrategyResolver, typeInfoResolver);
  }
View Full Code Here


  private PropertyAwareAccessor given_introspector_returns_PropertyAccessor(final String propertyName)
  {
    final BeanPropertyElementSelector propertyElement = new BeanPropertyElementSelector(propertyName);
    final PropertyAwareAccessor propertyAccessor = mock(PropertyAwareAccessor.class);
    when(propertyAccessor.getElementSelector()).thenReturn(propertyElement);
    final TypeInfo typeInfo = new TypeInfo(Class.class);
    typeInfo.addPropertyAccessor(propertyAccessor);
    when(typeInfoResolver.typeInfoForNode(any(DiffNode.class))).thenReturn(typeInfo);
    return propertyAccessor;
  }
View Full Code Here

  public TypeInfo typeInfoForNode(final DiffNode node)
  {
    final Class<?> beanType = node.getValueType();
    final Introspector introspector = introspectorForNode(node);
    final TypeInfo typeInfo = introspector.introspect(beanType);
    typeInfo.setInstanceFactory(instanceFactory);
    return typeInfo;
  }
View Full Code Here

  private static Iterable<PropertyAwareAccessor> getSiblingAccessors(final DiffNode node)
  {
    final DiffNode parentNode = node.getParentNode();
    if (parentNode != null)
    {
      final TypeInfo typeInfo = parentNode.getValueTypeInfo();
      if (typeInfo != null)
      {
        return typeInfo.getAccessors();
      }
    }
    return emptyList();
  }
View Full Code Here

    }
  }

  private void compareUsingIntrospection(final DiffNode beanNode, final Instances beanInstances)
  {
    final TypeInfo typeInfo = typeInfoResolver.typeInfoForNode(beanNode);
    beanNode.setValueTypeInfo(typeInfo);
    for (final PropertyAwareAccessor propertyAccessor : typeInfo.getAccessors())
    {
      final DiffNode propertyNode = differDispatcher.dispatch(beanNode, beanInstances, propertyAccessor);
      if (isReturnableResolver.isReturnable(propertyNode))
      {
        beanNode.addChild(propertyNode);
View Full Code Here

    }
  }

  private TypeInfo internalIntrospect(final Class<?> type) throws IntrospectionException
  {
    final TypeInfo typeInfo = new TypeInfo(type);
    final PropertyDescriptor[] descriptors = getBeanInfo(type).getPropertyDescriptors();
    for (final PropertyDescriptor descriptor : descriptors)
    {
      if (shouldSkip(descriptor))
      {
        continue;
      }
      final String propertyName = descriptor.getName();
      final Method readMethod = descriptor.getReadMethod();
      final Method writeMethod = descriptor.getWriteMethod();
      final PropertyAwareAccessor accessor = new PropertyAccessor(propertyName, readMethod, writeMethod);
      typeInfo.addPropertyAccessor(accessor);
    }
    return typeInfo;
  }
View Full Code Here

TOP

Related Classes of de.danielbechler.diff.instantiation.TypeInfo

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.