Examples of Getter


Examples of org.hibernate.property.Getter

    public void mapToEntityFromEntity(Object objTo, Object objFrom) {
        if (objTo == null || objFrom == null) {
            return;
        }

        Getter getter = ReflectionTools.getGetter(objFrom.getClass(), propertyData);
        Setter setter = ReflectionTools.getSetter(objTo.getClass(), propertyData);
        setter.set(objTo, getter.get(objFrom), null);
    }
View Full Code Here

Examples of org.hibernate.property.Getter

    public void mapToMapFromEntity(Map<String, Object> data, Object obj) {
        if (obj == null) {
            return;
        }

        Getter getter = ReflectionTools.getGetter(obj.getClass(), idPropertyData);
        mapToMapFromId(data, getter.get(obj));
    }
View Full Code Here

Examples of org.hibernate.property.Getter

    public boolean mapToEntityFromMap(Object obj, Map data) {
        if (data == null || obj == null) {
            return false;
        }

        Getter getter = ReflectionTools.getGetter(obj.getClass(), idPropertyData);
        Setter setter = ReflectionTools.getSetter(obj.getClass(), idPropertyData);

        try {
            Object subObj = ReflectHelper.getDefaultConstructor( getter.getReturnType() ).newInstance();

            boolean ret = true;
            for (IdMapper idMapper : ids.values()) {
                ret &= idMapper.mapToEntityFromMap(subObj, data);
            }
View Full Code Here

Examples of org.hibernate.property.Getter

    public Object mapToIdFromEntity(Object data) {
        if (data == null) {
            return null;
        }

        Getter getter = ReflectionTools.getGetter(data.getClass(), idPropertyData);
        return getter.get(data);
    }
View Full Code Here

Examples of org.hibernate.property.Getter

    mappings = new Configuration().createMappings();
  }

  public void testStringElementExtraction() throws Throwable {
    Property property = generateNameProperty();
    Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
        .getGetter( null, null );
    String name = ( String ) getter.get( DOM );
    assertEquals( "Not equals", "JBoss", name );
  }
View Full Code Here

Examples of org.hibernate.property.Getter

    assertEquals( "Not equals", "JBoss", name );
  }

  public void testStringTextExtraction() throws Throwable {
    Property property = generateTextProperty();
    Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
        .getGetter( null, null );
    String name = ( String ) getter.get( DOM );
    assertEquals( "Not equals", "description...", name );
  }
View Full Code Here

Examples of org.hibernate.property.Getter

    assertEquals( "Not equals", "description...", name );
  }

  public void testLongAttributeExtraction() throws Throwable {
    Property property = generateIdProperty();
    Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
        .getGetter( null, null );
    Long id = ( Long ) getter.get( DOM );
    assertEquals( "Not equals", new Long( 123 ), id );
  }
View Full Code Here

Examples of org.hibernate.property.Getter

    assertEquals( "Not equals", new Long( 123 ), id );
  }

  public void testLongElementAttributeExtraction() throws Throwable {
    Property property = generateAccountIdProperty();
    Getter getter = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.DOM4J )
        .getGetter( null, null );
    Long id = ( Long ) getter.get( DOM );
    assertEquals( "Not equals", new Long( 456 ), id );
  }
View Full Code Here

Examples of org.hibernate.property.Getter

  private void addSubElement(Property property, ValidatableElement element) {
    if ( property != null && property.isComposite() && !property.isBackRef() ) {
      Component component = (Component) property.getValue();
      if ( component.isEmbedded() ) return;
      PropertyAccessor accessor = PropertyAccessorFactory.getPropertyAccessor( property, EntityMode.POJO );
      Getter getter = accessor.getGetter( element.clazz, property.getName() );
      ClassValidator validator = new ClassValidator( getter.getReturnType() );
      ValidatableElement subElement = new ValidatableElement( getter.getReturnType(), validator, getter );
      Iterator properties = component.getPropertyIterator();
      while ( properties.hasNext() ) {
        addSubElement( (Property) properties.next(), subElement );
      }
      if ( subElement.getSubElements().size() != 0 || subElement.validator.hasValidationRules() ) {
View Full Code Here

Examples of org.hibernate.property.Getter

    Class clazz = bean.getClass();
    String[] params = getNamedParameters();
    for (int i = 0; i < params.length; i++) {
      String namedParam = params[i];
      try {
        Getter getter = ReflectHelper.getGetter( clazz, namedParam );
        Class retType = getter.getReturnType();
        final Object object = getter.get( bean );
        if ( Collection.class.isAssignableFrom( retType ) ) {
          setParameterList( namedParam, ( Collection ) object );
        }
        else if ( retType.isArray() ) {
           setParameterList( namedParam, ( Object[] ) object );
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.