org.eclipse.persistence.internal.helper.Helper.getObjectClass()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(13.3k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.eclipse.persistence.internal.helper.Helper.getObjectClass()方法的一些代码示例,展示了Helper.getObjectClass()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.getObjectClass()方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:getObjectClass

Helper.getObjectClass介绍

[英]Returns the object class. If a class is primitive return its non primitive class
[中]返回对象类。如果类是基元类,则返回其非基元类

代码示例

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Return the classification for the field contained in the mapping.
 * This is used to convert the row value to a consistent Java value.
 */
public Class getFieldClassification(DatabaseField fieldToClassify) {
  // PERF: This method is a major performance code point,
  // so has been micro optimized and uses direct variable access.
  if (fieldToClassify.type != null) {
    return fieldToClassify.type;
  } else {
    if (this.converter != null) {
      return null;
    } else {
      // PERF: Ensure the object type is used for primitives.
      return Helper.getObjectClass(this.attributeClassification);
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL: Return the argumentTypes for use with the pre-defined query
 * option
 */
public List<Class> getArgumentTypes() {
  if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty() && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) {
    this.argumentTypes = new ArrayList<Class>();
    // Bug 3256198 - lazily initialize the argument types from their
    // class names
    if (this.argumentTypeNames != null) {
      Iterator args = this.argumentTypeNames.iterator();
      while (args.hasNext()) {
        String argumentTypeName = (String) args.next();
        this.argumentTypes.add(Helper.getObjectClass(ConversionManager.loadClass(argumentTypeName)));
      }
    }
  }
  return this.argumentTypes;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Return the classification for the field contained in the mapping.
 * This is used to convert the row value to a consistent Java value.
 */
public Class getFieldClassification(DatabaseField fieldToClassify) {
  // PERF: This method is a major performance code point,
  // so has been micro optimized and uses direct variable access.
  if (fieldToClassify.type != null) {
    return fieldToClassify.type;
  } else {
    if (hasConverter()) {
      return null;
    } else {
      // PERF: Ensure the object type is used for primitives.
      return Helper.getObjectClass(this.attributeClassification);
    }
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL: Return the argumentTypes for use with the pre-defined query
 * option
 */
public List<Class> getArgumentTypes() {
  if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty() && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) {
    this.argumentTypes = new ArrayList<Class>();
    // Bug 3256198 - lazily initialize the argument types from their
    // class names
    if (this.argumentTypeNames != null) {
      Iterator args = this.argumentTypeNames.iterator();
      while (args.hasNext()) {
        String argumentTypeName = (String) args.next();
        this.argumentTypes.add(Helper.getObjectClass(ConversionManager.loadClass(argumentTypeName)));
      }
    }
  }
  return this.argumentTypes;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Return the classification for the field contained in the mapping.
 * This is used to convert the row value to a consistent Java value.
 */
public Class getFieldClassification(DatabaseField fieldToClassify) {
  // PERF: This method is a major performance code point,
  // so has been micro optimized and uses direct variable access.
  if (fieldToClassify.type != null) {
    return fieldToClassify.type;
  } else {
    if (hasConverter()) {
      return null;
    } else {
      // PERF: Ensure the object type is used for primitives.
      return Helper.getObjectClass(this.attributeClassification);
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Return the argumentTypes for use with the pre-defined query option
 */
public List<Class> getArgumentTypes() {
  if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty()
      && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) {
    this.argumentTypes = new ArrayList<Class>();
    // Bug 3256198 - lazily initialize the argument types from their class names
    if (this.argumentTypeNames != null) {
      Iterator args = this.argumentTypeNames.iterator();
      while (args.hasNext()) {
        String argumentTypeName = (String)args.next();
        this.argumentTypes.add(Helper.getObjectClass(ConversionManager.loadClass(argumentTypeName)));
      }
    }
  }
  return this.argumentTypes;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * Return primary key classifications.
 * These are used to ensure a consistent type for the pk values.
 */
public List<Class> getPrimaryKeyClassifications() {
  if (primaryKeyClassifications == null) {
    List primaryKeyFields = this.descriptor.getPrimaryKeyFields();
    List<Class> classifications = new ArrayList(primaryKeyFields.size());
    for (int index = 0; index < primaryKeyFields.size(); index++) {
      DatabaseMapping mapping = getPrimaryKeyMappings().get(index);
      DatabaseField field = (DatabaseField)primaryKeyFields.get(index);
      if (mapping != null) {
        classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field)));
      } else {
        classifications.add(null);
      }
      primaryKeyClassifications = classifications;
    }
  }
  return primaryKeyClassifications;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * PUBLIC: Add the argument named argumentName and its class type. This will
 * cause the translation of references of argumentName in the receiver's
 * expression, with the value of the argument as supplied to the query in
 * order from executeQuery(). Specifying the class type is important if
 * identically named queries are used but with different argument lists.
 */
public void addArgument(String argumentName, String typeAsString) {
  getArguments().add(argumentName);
  // bug 3197587
  getArgumentTypes().add(Helper.getObjectClass(ConversionManager.loadClass(typeAsString)));
  getArgumentTypeNames().add(typeAsString);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * PUBLIC: Add the argument named argumentName and its class type. This will
 * cause the translation of references of argumentName in the receiver's
 * expression, with the value of the argument as supplied to the query in
 * order from executeQuery(). Specifying the class type is important if
 * identically named queries are used but with different argument lists.
 */
public void addArgument(String argumentName, String typeAsString) {
  getArguments().add(argumentName);
  // bug 3197587
  getArgumentTypes().add(Helper.getObjectClass(ConversionManager.loadClass(typeAsString)));
  getArgumentTypeNames().add(typeAsString);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Return primary key classifications.
 * These are used to ensure a consistent type for the pk values.
 */
public List<Class> getPrimaryKeyClassifications() {
  if (primaryKeyClassifications == null) {
    List primaryKeyFields = this.descriptor.getPrimaryKeyFields();
    if(null == primaryKeyFields) {
      return Collections.emptyList();
    }
    List<Class> classifications = new ArrayList(primaryKeyFields.size());
    for (int index = 0; index < primaryKeyFields.size(); index++) {
      if (getPrimaryKeyMappings().size() < (index + 1)) { // Check for failed initialization to avoid cascaded errors.
        classifications.add(null);
      } else {
        DatabaseMapping mapping = getPrimaryKeyMappings().get(index);
        DatabaseField field = (DatabaseField)primaryKeyFields.get(index);
        if (mapping != null) {
          classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field)));
        } else {
          classifications.add(null);
        }
      }
    }
    primaryKeyClassifications = classifications;
  }
  return primaryKeyClassifications;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Return primary key classifications.
 * These are used to ensure a consistent type for the pk values.
 */
public List<Class> getPrimaryKeyClassifications() {
  if (primaryKeyClassifications == null) {
    List primaryKeyFields = this.descriptor.getPrimaryKeyFields();
    if(null == primaryKeyFields) {
      return Collections.emptyList();
    }
    List<Class> classifications = new ArrayList(primaryKeyFields.size());
    for (int index = 0; index < primaryKeyFields.size(); index++) {
      if (getPrimaryKeyMappings().size() < (index + 1)) { // Check for failed initialization to avoid cascaded errors.
        classifications.add(null);
      } else {
        DatabaseMapping mapping = getPrimaryKeyMappings().get(index);
        DatabaseField field = (DatabaseField)primaryKeyFields.get(index);
        if (mapping != null) {
          classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field)));
        } else {
          classifications.add(null);
        }
      }
    }
    primaryKeyClassifications = classifications;
  }
  return primaryKeyClassifications;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * PUBLIC:
 * Add the argument named argumentName and its class type.
 * This will cause the translation of references of argumentName in the receiver's expression,
 * with the value of the argument as supplied to the query in order from executeQuery().
 * Specifying the class type is important if identically named queries are used but with
 * different argument lists.
 */
public void addArgument(String argumentName, String typeAsString) {
  getArguments().add(argumentName);
  //bug 3197587
  getArgumentTypes().add(Helper.getObjectClass(ConversionManager.loadClass(typeAsString)));
  getArgumentTypeNames().add(typeAsString);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually
 * mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the
 * remote session.
 */
@Override
public void remoteInitialization(DistributedSession session) {
  if (!isRemotelyInitialized()) {
    super.remoteInitialization(session);
    if (this.attributeClassification == null) {
      this.attributeClassification = getAttributeAccessor().getAttributeClass();
    }
    this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually
 * mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the
 * remote session.
 */
public void remoteInitialization(DistributedSession session) {
  if (!isRemotelyInitialized()) {
    super.remoteInitialization(session);
    if (this.attributeClassification == null) {
      this.attributeClassification = getAttributeAccessor().getAttributeClass();
    }
    this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually
 * mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the
 * remote session.
 */
@Override
public void remoteInitialization(DistributedSession session) {
  if (!isRemotelyInitialized()) {
    super.remoteInitialization(session);
    if (this.attributeClassification == null) {
      this.attributeClassification = getAttributeAccessor().getAttributeClass();
    }
    this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

expectedType = Helper.getObjectClass(expectedType);

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

expectedType = Helper.getObjectClass(expectedType);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Initialize the attribute classification.
 * @Throws DescriptorException when attributeClassification is null
 */
public void preInitialize(AbstractSession session) throws DescriptorException {
  super.preInitialize(session);
  // Allow the attribute class to be set by the user.
  if (this.attributeClassification == null) {
    this.attributeClassification = getAttributeAccessor().getAttributeClass();
  }
  this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  
  // Initialize isMutable if not specified, default is false (assumes not mutable).
  if (this.isMutable == null) {
    if (getConverter() != null) {
      setIsMutable(getConverter().isMutable());
    } else {
      setIsMutable(false);
    }
    // If mapping a temporal type, use the project mutable default.
    if (ClassConstants.UTILDATE.isAssignableFrom(getAttributeClassification())
        || ClassConstants.CALENDAR.isAssignableFrom(getAttributeClassification())) {
      setIsMutable(session.getProject().getDefaultTemporalMutable());
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Initialize the attribute classification.
 */
@Override
public void preInitialize(AbstractSession session) throws DescriptorException {
  super.preInitialize(session);
  // Allow the attribute class to be set by the user.
  if (this.attributeClassification == null) {
    this.attributeClassification = getAttributeAccessor().getAttributeClass();
  }
  this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  // Initialize isMutable if not specified, default is false (assumes not mutable).
  if (this.isMutable == null) {
    if (hasConverter()) {
      setIsMutable(getConverter().isMutable());
    } else {
      setIsMutable(false);
    }
    // If mapping a temporal type, use the project mutable default.
    if ((getAttributeClassification() != null)
        && (ClassConstants.UTILDATE.isAssignableFrom(getAttributeClassification())
            || ClassConstants.CALENDAR.isAssignableFrom(getAttributeClassification()))) {
      setIsMutable(session.getProject().getDefaultTemporalMutable());
    }
  }
  Map nullValues = session.getPlatform(this.descriptor.getJavaClass()).getConversionManager().getDefaultNullValues();
  bypassDefaultNullValueCheck = (!this.attributeClassification.isPrimitive()) &&
      ((nullValues == null) || (!nullValues.containsKey(this.attributeClassification)));
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

this.attributeClassification = getAttributeAccessor().getAttributeClass();
this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);

相关文章

Helper类方法