Package org.hibernate.property

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


    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

  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

    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

      return false;
    }
  }
 
  public Getter getGetter(final Class theClass, final String propertyName) throws PropertyNotFoundException {
    return new Getter() {
      public Object get(Object owner) throws HibernateException {
                if(defaultValue != null) {
                    return defaultValue;
                }
View Full Code Here

    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

    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

    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

      );
    }

    if ( strategy instanceof ValidityAuditStrategy ) {
      // further initialization required
      final Getter revisionTimestampGetter = ReflectionTools.getGetter( revisionInfoClass, revisionInfoTimestampData );
      ( (ValidityAuditStrategy) strategy ).setRevisionTimestampGetter( revisionTimestampGetter );
    }

    return strategy;
  }
View Full Code Here

    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

Related Classes of org.hibernate.property.Getter

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.