Package com.avaje.ebeaninternal.server.deploy.meta

Examples of com.avaje.ebeaninternal.server.deploy.meta.DeployBeanProperty


      cacheOptions.setUseCache(cacheStrategy.useBeanCache());
      cacheOptions.setReadOnly(cacheStrategy.readOnly());
      cacheOptions.setWarmingQuery(cacheStrategy.warmingQuery());
      if (cacheStrategy.naturalKey().length() > 0) {
        String propName = cacheStrategy.naturalKey().trim();
        DeployBeanProperty beanProperty = descriptor.getBeanProperty(propName);
        if (beanProperty != null) {
          beanProperty.setNaturalKey(true);
          cacheOptions.setNaturalKey(propName);
        }
      }
    }
  }
View Full Code Here


     */
    public void process(DeployBeanDescriptor<?> desc) {
       
        List<DeployBeanProperty> props = desc.propertiesBase();
        for (int i = 0; i < props.size(); i++) {
          DeployBeanProperty prop = props.get(i);
            if (!prop.isDbRead() && !prop.isDbInsertable() && !prop.isDbUpdateable()) {
              // non-transient...
              prop.setTransient(true);
            }
    }

        List<DeployBeanPropertyAssocOne<?>> ones = desc.propertiesAssocOne();
        for (int i = 0; i < ones.size(); i++) {
          DeployBeanPropertyAssocOne<?> prop = ones.get(i);
            if (prop.getBeanTable() == null) {
                if (!prop.isEmbedded()) {
                  prop.setTransient(true);
                }
            }
        }

        List<DeployBeanPropertyAssocMany<?>> manys = desc.propertiesAssocMany();
        for (int i = 0; i < manys.size(); i++) {
          DeployBeanPropertyAssocMany<?> prop = manys.get(i);
          if (prop.getBeanTable() == null) {
              prop.setTransient(true);
            }
        }
               
    }
View Full Code Here

    // its associated join information if it is available
    String mappedBy = prop.getMappedBy();

    // get the mappedBy property
    DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
    DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
    if (mappedProp == null) {
      String m = "Error on " + prop.getFullBeanName();
      m += "  Can not find mappedBy property [" + targetDesc + "." + mappedBy + "] ";
      throw new PersistenceException(m);
    }
View Full Code Here

    // its associated join information if it is available
    String mappedBy = prop.getMappedBy();

    // get the mappedBy property
    DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
    DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);
    if (mappedProp == null) {

      String m = "Error on " + prop.getFullBeanName();
      m += "  Can not find mappedBy property [" + mappedBy + "] ";
      m += "in [" + targetDesc + "]";
View Full Code Here

      return;
    }

    // get the mappedBy property
    DeployBeanDescriptor<?> targetDesc = getTargetDescriptor(prop);
    DeployBeanProperty mappedProp = targetDesc.getBeanProperty(mappedBy);

    if (mappedProp == null) {
      String m = "Error on " + prop.getFullBeanName();
      m += "  Can not find mappedBy property [" + mappedBy + "] ";
      m += "in [" + targetDesc + "]";
View Full Code Here

          String initFieldName = initCap(fieldName);

          Method getter = findGetter(field, initFieldName, declaredMethods, scalaObject);
          Method setter = findSetter(field, initFieldName, declaredMethods, scalaObject);

          DeployBeanProperty prop = createProp(level, desc, field, beanType, getter, setter);
          if (prop == null) {
            // transient annotation on unsupported type

          } else {
            // set a order that gives priority to inherited properties
            // push Id/EmbeddedId up and CreatedTimestamp/UpdatedTimestamp down
            int sortOverride = prop.getSortOverride();
            prop.setSortOrder((level * 10000 + 100 - i + sortOverride));

            DeployBeanProperty replaced = desc.addBeanProperty(prop);
            if (replaced != null) {
              if (replaced.isTransient()) {
                // expected for inheritance...
              } else {
                String msg = "Huh??? property " + prop.getFullBeanName() + " being defined twice";
                msg += " but replaced property was not transient? This is not expected?";
                logger.warn(msg);
View Full Code Here

    if (specialTypeKey != null) {
      ScalarType<?> scalarType = typeManager.getScalarTypeFromKey(specialTypeKey);
      if (scalarType == null) {
        logger.error("Could not find ScalarType to match key ["+specialTypeKey+"]");
      } else {
        return new DeployBeanProperty(desc, propertyType, scalarType, null);
      }
    }
   
    // check for Collection type (list, set or map)
    ManyType manyType = determineManyType.getManyType(propertyType);

    if (manyType != null) {
      // List, Set or Map based object
      Class<?> targetType = determineTargetType(field);
      if (targetType == null) {
        Transient transAnnotation = field.getAnnotation(Transient.class);
        if (transAnnotation != null) {
          // not supporting this field (generic type used)
          return null;
        }
        logger.warn("Could not find parameter type (via reflection) on " + desc.getFullName() + " " + field.getName());
      }
      return createManyType(desc, targetType, manyType);
    }

    if (innerType.isEnum() || innerType.isPrimitive()) {
      return new DeployBeanProperty(desc, propertyType, null, null);
    }

    ScalarType<?> scalarType = typeManager.getScalarType(innerType);
    if (scalarType != null) {
      return new DeployBeanProperty(desc, propertyType, scalarType, null);
    }

    CtCompoundType<?> compoundType = typeManager.getCompoundType(innerType);
    if (compoundType != null) {
      return new DeployBeanPropertyCompound(desc, propertyType, compoundType, null);
    }

    if (isTransientField(field)) {
      return null;
    }
    try {
      CheckImmutableResponse checkImmutable = typeManager.checkImmutable(innerType);
      if (checkImmutable.isImmutable()) {
        if (checkImmutable.isCompoundType()) {
          // use reflection to support compound immutable value objects
          typeManager.recursiveCreateScalarDataReader(innerType);
          compoundType = typeManager.getCompoundType(innerType);
          if (compoundType != null) {
            return new DeployBeanPropertyCompound(desc, propertyType, compoundType, null);
          }

        } else {
          // use reflection to support simple immutable value objects
          scalarType = typeManager.recursiveCreateScalarTypes(innerType);
          return new DeployBeanProperty(desc, propertyType, scalarType, null);
        }
      }

      return new DeployBeanPropertyAssocOne(desc, propertyType);
View Full Code Here

  }

  private DeployBeanProperty createProp(int level, DeployBeanDescriptor<?> desc, Field field, Class<?> beanType,
      Method getter, Method setter) {

    DeployBeanProperty prop = createProp(desc, field);
    if (prop == null) {
      // transient annotation on unsupported type
      return null;
    } else {
      prop.setOwningType(beanType);
      prop.setName(field.getName());

      // the getter or setter could be null if we are using
      // javaagent type enhancement. If we are using subclass
      // generation then we do need to find the getter and setter
      prop.setReadMethod(getter);
      prop.setWriteMethod(setter);
      prop.setField(field);
      return prop;
    }
  }
View Full Code Here

TOP

Related Classes of com.avaje.ebeaninternal.server.deploy.meta.DeployBeanProperty

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.