Package org.springframework.data.util

Examples of org.springframework.data.util.DirectFieldAccessFallbackBeanWrapper


   * @see org.springframework.data.repository.core.EntityInformation#getId(java.lang.Object)
   */
  @SuppressWarnings("unchecked")
  public ID getId(T entity) {

    BeanWrapper entityWrapper = new DirectFieldAccessFallbackBeanWrapper(entity);

    if (idMetadata.hasSimpleId()) {
      return (ID) entityWrapper.getPropertyValue(idMetadata.getSimpleIdAttribute().getName());
    }

    BeanWrapper idWrapper = new IdentifierDerivingDirectFieldAccessFallbackBeanWrapper(idMetadata.getType(), metamodel);
    boolean partialIdValueFound = false;

    for (SingularAttribute<? super T, ?> attribute : idMetadata) {
      Object propertyValue = entityWrapper.getPropertyValue(attribute.getName());

      if (propertyValue != null) {
        partialIdValueFound = true;
      }

View Full Code Here


   * (non-Javadoc)
   * @see org.springframework.data.jpa.repository.support.JpaEntityInformation#getCompositeIdAttributeValue(java.io.Serializable, java.lang.String)
   */
  public Object getCompositeIdAttributeValue(Serializable id, String idAttribute) {
    Assert.isTrue(hasCompositeId());
    return new DirectFieldAccessFallbackBeanWrapper(id).getPropertyValue(idAttribute);
  }
View Full Code Here

    if (versionAttribute == null || versionAttribute.getJavaType().isPrimitive()) {
      return super.isNew(entity);
    }

    BeanWrapper wrapper = new DirectFieldAccessFallbackBeanWrapper(entity);
    Object versionValue = wrapper.getPropertyValue(versionAttribute.getName());

    return versionValue == null;
  }
View Full Code Here

        // Derive the identifer from the nested entity that is part of the composite key.
        @SuppressWarnings({ "rawtypes", "unchecked" })
        JpaMetamodelEntityInformation nestedEntityInformation = new JpaMetamodelEntityInformation(value.getClass(),
            this.metamodel);
        Object nestedIdPropertyValue = new DirectFieldAccessFallbackBeanWrapper(value)
            .getPropertyValue(nestedEntityInformation.getIdAttribute().getName());
        super.setPropertyValue(propertyName, nestedIdPropertyValue);

        return;
      }
View Full Code Here

   * @param target must not be {@literal null}.
   */
  public PropertyAccessingMethodInterceptor(Object target) {

    Assert.notNull(target, "Proxy target must not be null!");
    this.target = new DirectFieldAccessFallbackBeanWrapper(target);
  }
View Full Code Here

        }

        PersistentEntity persistentEntity = domainTypeAdministrationConfiguration.getPersistentEntity();
        PersistentProperty idProperty = persistentEntity.getIdProperty();

        BeanWrapper beanWrapper = new DirectFieldAccessFallbackBeanWrapper(entity);

        return String.valueOf(beanWrapper.getPropertyValue(idProperty.getName()));
    }
View Full Code Here

        return property;
    }

    @Override
    public Object getValue(Object entity) {
        return new DirectFieldAccessFallbackBeanWrapper(entity).getPropertyValue(property);
    }
View Full Code Here

            this.entityName = entityName;
        }

        @Override
        public String apply(final Object entity) {
            BeanWrapper beanWrapper = new DirectFieldAccessFallbackBeanWrapper(entity);
            Object entityId = beanWrapper.getPropertyValue(persistentEntity.getIdProperty().getName());

            return String.format("%s #%s", entityName, entityId);
        }
View Full Code Here

    private static class NotEmptyFileReferencePropertiesCollector extends FileReferencePropertyHandler {
        private final BeanWrapper beanWrapper;
        private final FileReferenceProperties fileReferenceProperties;

        private NotEmptyFileReferencePropertiesCollector(Object instance) {
            this.beanWrapper = new DirectFieldAccessFallbackBeanWrapper(instance);
            this.fileReferenceProperties = new FileReferenceProperties();
        }
View Full Code Here

        PersistentProperty idAttribute = domainTypeConfiguration.getPersistentEntity().getIdProperty();
        EntityNameExtractor<Object> nameExtractor = domainTypeConfiguration.getEntityConfiguration().getNameExtractor();
        JspContext jspContext = getJspContext();
        JspFragment tagBody = getJspBody();
        for (Object element : allElements) {
            BeanWrapper beanWrapper = new DirectFieldAccessFallbackBeanWrapper(element);

            jspContext.setAttribute(idVar, beanWrapper.getPropertyValue(idAttribute.getName()));
            jspContext.setAttribute(stringRepresentationVar, exceptionAwareNameExtractor(nameExtractor, domainTypeConfiguration).apply(element));
            tagBody.invoke(null);
        }
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.util.DirectFieldAccessFallbackBeanWrapper

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.