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

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

本文整理了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

  1. /**
  2. * INTERNAL:
  3. * Return the classification for the field contained in the mapping.
  4. * This is used to convert the row value to a consistent Java value.
  5. */
  6. public Class getFieldClassification(DatabaseField fieldToClassify) {
  7. // PERF: This method is a major performance code point,
  8. // so has been micro optimized and uses direct variable access.
  9. if (fieldToClassify.type != null) {
  10. return fieldToClassify.type;
  11. } else {
  12. if (this.converter != null) {
  13. return null;
  14. } else {
  15. // PERF: Ensure the object type is used for primitives.
  16. return Helper.getObjectClass(this.attributeClassification);
  17. }
  18. }
  19. }

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

  1. /**
  2. * INTERNAL: Return the argumentTypes for use with the pre-defined query
  3. * option
  4. */
  5. public List<Class> getArgumentTypes() {
  6. if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty() && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) {
  7. this.argumentTypes = new ArrayList<Class>();
  8. // Bug 3256198 - lazily initialize the argument types from their
  9. // class names
  10. if (this.argumentTypeNames != null) {
  11. Iterator args = this.argumentTypeNames.iterator();
  12. while (args.hasNext()) {
  13. String argumentTypeName = (String) args.next();
  14. this.argumentTypes.add(Helper.getObjectClass(ConversionManager.loadClass(argumentTypeName)));
  15. }
  16. }
  17. }
  18. return this.argumentTypes;
  19. }

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

  1. /**
  2. * INTERNAL:
  3. * Return the classification for the field contained in the mapping.
  4. * This is used to convert the row value to a consistent Java value.
  5. */
  6. public Class getFieldClassification(DatabaseField fieldToClassify) {
  7. // PERF: This method is a major performance code point,
  8. // so has been micro optimized and uses direct variable access.
  9. if (fieldToClassify.type != null) {
  10. return fieldToClassify.type;
  11. } else {
  12. if (hasConverter()) {
  13. return null;
  14. } else {
  15. // PERF: Ensure the object type is used for primitives.
  16. return Helper.getObjectClass(this.attributeClassification);
  17. }
  18. }
  19. }

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

  1. /**
  2. * INTERNAL: Return the argumentTypes for use with the pre-defined query
  3. * option
  4. */
  5. public List<Class> getArgumentTypes() {
  6. if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty() && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) {
  7. this.argumentTypes = new ArrayList<Class>();
  8. // Bug 3256198 - lazily initialize the argument types from their
  9. // class names
  10. if (this.argumentTypeNames != null) {
  11. Iterator args = this.argumentTypeNames.iterator();
  12. while (args.hasNext()) {
  13. String argumentTypeName = (String) args.next();
  14. this.argumentTypes.add(Helper.getObjectClass(ConversionManager.loadClass(argumentTypeName)));
  15. }
  16. }
  17. }
  18. return this.argumentTypes;
  19. }

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

  1. /**
  2. * INTERNAL:
  3. * Return the classification for the field contained in the mapping.
  4. * This is used to convert the row value to a consistent Java value.
  5. */
  6. public Class getFieldClassification(DatabaseField fieldToClassify) {
  7. // PERF: This method is a major performance code point,
  8. // so has been micro optimized and uses direct variable access.
  9. if (fieldToClassify.type != null) {
  10. return fieldToClassify.type;
  11. } else {
  12. if (hasConverter()) {
  13. return null;
  14. } else {
  15. // PERF: Ensure the object type is used for primitives.
  16. return Helper.getObjectClass(this.attributeClassification);
  17. }
  18. }
  19. }

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

  1. /**
  2. * INTERNAL:
  3. * Return the argumentTypes for use with the pre-defined query option
  4. */
  5. public List<Class> getArgumentTypes() {
  6. if ((this.argumentTypes == null) || (this.argumentTypes.isEmpty()
  7. && (this.argumentTypeNames != null) && !this.argumentTypeNames.isEmpty())) {
  8. this.argumentTypes = new ArrayList<Class>();
  9. // Bug 3256198 - lazily initialize the argument types from their class names
  10. if (this.argumentTypeNames != null) {
  11. Iterator args = this.argumentTypeNames.iterator();
  12. while (args.hasNext()) {
  13. String argumentTypeName = (String)args.next();
  14. this.argumentTypes.add(Helper.getObjectClass(ConversionManager.loadClass(argumentTypeName)));
  15. }
  16. }
  17. }
  18. return this.argumentTypes;
  19. }

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

  1. /**
  2. * Return primary key classifications.
  3. * These are used to ensure a consistent type for the pk values.
  4. */
  5. public List<Class> getPrimaryKeyClassifications() {
  6. if (primaryKeyClassifications == null) {
  7. List primaryKeyFields = this.descriptor.getPrimaryKeyFields();
  8. List<Class> classifications = new ArrayList(primaryKeyFields.size());
  9. for (int index = 0; index < primaryKeyFields.size(); index++) {
  10. DatabaseMapping mapping = getPrimaryKeyMappings().get(index);
  11. DatabaseField field = (DatabaseField)primaryKeyFields.get(index);
  12. if (mapping != null) {
  13. classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field)));
  14. } else {
  15. classifications.add(null);
  16. }
  17. primaryKeyClassifications = classifications;
  18. }
  19. }
  20. return primaryKeyClassifications;
  21. }

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

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

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

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

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

  1. /**
  2. * Return primary key classifications.
  3. * These are used to ensure a consistent type for the pk values.
  4. */
  5. public List<Class> getPrimaryKeyClassifications() {
  6. if (primaryKeyClassifications == null) {
  7. List primaryKeyFields = this.descriptor.getPrimaryKeyFields();
  8. if(null == primaryKeyFields) {
  9. return Collections.emptyList();
  10. }
  11. List<Class> classifications = new ArrayList(primaryKeyFields.size());
  12. for (int index = 0; index < primaryKeyFields.size(); index++) {
  13. if (getPrimaryKeyMappings().size() < (index + 1)) { // Check for failed initialization to avoid cascaded errors.
  14. classifications.add(null);
  15. } else {
  16. DatabaseMapping mapping = getPrimaryKeyMappings().get(index);
  17. DatabaseField field = (DatabaseField)primaryKeyFields.get(index);
  18. if (mapping != null) {
  19. classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field)));
  20. } else {
  21. classifications.add(null);
  22. }
  23. }
  24. }
  25. primaryKeyClassifications = classifications;
  26. }
  27. return primaryKeyClassifications;
  28. }

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

  1. /**
  2. * Return primary key classifications.
  3. * These are used to ensure a consistent type for the pk values.
  4. */
  5. public List<Class> getPrimaryKeyClassifications() {
  6. if (primaryKeyClassifications == null) {
  7. List primaryKeyFields = this.descriptor.getPrimaryKeyFields();
  8. if(null == primaryKeyFields) {
  9. return Collections.emptyList();
  10. }
  11. List<Class> classifications = new ArrayList(primaryKeyFields.size());
  12. for (int index = 0; index < primaryKeyFields.size(); index++) {
  13. if (getPrimaryKeyMappings().size() < (index + 1)) { // Check for failed initialization to avoid cascaded errors.
  14. classifications.add(null);
  15. } else {
  16. DatabaseMapping mapping = getPrimaryKeyMappings().get(index);
  17. DatabaseField field = (DatabaseField)primaryKeyFields.get(index);
  18. if (mapping != null) {
  19. classifications.add(Helper.getObjectClass(mapping.getFieldClassification(field)));
  20. } else {
  21. classifications.add(null);
  22. }
  23. }
  24. }
  25. primaryKeyClassifications = classifications;
  26. }
  27. return primaryKeyClassifications;
  28. }

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

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

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

  1. /**
  2. * INTERNAL:
  3. * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually
  4. * mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the
  5. * remote session.
  6. */
  7. @Override
  8. public void remoteInitialization(DistributedSession session) {
  9. if (!isRemotelyInitialized()) {
  10. super.remoteInitialization(session);
  11. if (this.attributeClassification == null) {
  12. this.attributeClassification = getAttributeAccessor().getAttributeClass();
  13. }
  14. this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  15. }
  16. }

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

  1. /**
  2. * INTERNAL:
  3. * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually
  4. * mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the
  5. * remote session.
  6. */
  7. public void remoteInitialization(DistributedSession session) {
  8. if (!isRemotelyInitialized()) {
  9. super.remoteInitialization(session);
  10. if (this.attributeClassification == null) {
  11. this.attributeClassification = getAttributeAccessor().getAttributeClass();
  12. }
  13. this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  14. }
  15. }

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

  1. /**
  2. * INTERNAL:
  3. * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually
  4. * mappings are initialized and serialized reference descriptors are replaced with local descriptors if they already exist on the
  5. * remote session.
  6. */
  7. @Override
  8. public void remoteInitialization(DistributedSession session) {
  9. if (!isRemotelyInitialized()) {
  10. super.remoteInitialization(session);
  11. if (this.attributeClassification == null) {
  12. this.attributeClassification = getAttributeAccessor().getAttributeClass();
  13. }
  14. this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  15. }
  16. }

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

  1. expectedType = Helper.getObjectClass(expectedType);

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

  1. expectedType = Helper.getObjectClass(expectedType);

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

  1. /**
  2. * INTERNAL:
  3. * Initialize the attribute classification.
  4. * @Throws DescriptorException when attributeClassification is null
  5. */
  6. public void preInitialize(AbstractSession session) throws DescriptorException {
  7. super.preInitialize(session);
  8. // Allow the attribute class to be set by the user.
  9. if (this.attributeClassification == null) {
  10. this.attributeClassification = getAttributeAccessor().getAttributeClass();
  11. }
  12. this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  13. // Initialize isMutable if not specified, default is false (assumes not mutable).
  14. if (this.isMutable == null) {
  15. if (getConverter() != null) {
  16. setIsMutable(getConverter().isMutable());
  17. } else {
  18. setIsMutable(false);
  19. }
  20. // If mapping a temporal type, use the project mutable default.
  21. if (ClassConstants.UTILDATE.isAssignableFrom(getAttributeClassification())
  22. || ClassConstants.CALENDAR.isAssignableFrom(getAttributeClassification())) {
  23. setIsMutable(session.getProject().getDefaultTemporalMutable());
  24. }
  25. }
  26. }

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

  1. /**
  2. * INTERNAL:
  3. * Initialize the attribute classification.
  4. */
  5. @Override
  6. public void preInitialize(AbstractSession session) throws DescriptorException {
  7. super.preInitialize(session);
  8. // Allow the attribute class to be set by the user.
  9. if (this.attributeClassification == null) {
  10. this.attributeClassification = getAttributeAccessor().getAttributeClass();
  11. }
  12. this.attributeObjectClassification = Helper.getObjectClass(this.attributeClassification);
  13. // Initialize isMutable if not specified, default is false (assumes not mutable).
  14. if (this.isMutable == null) {
  15. if (hasConverter()) {
  16. setIsMutable(getConverter().isMutable());
  17. } else {
  18. setIsMutable(false);
  19. }
  20. // If mapping a temporal type, use the project mutable default.
  21. if ((getAttributeClassification() != null)
  22. && (ClassConstants.UTILDATE.isAssignableFrom(getAttributeClassification())
  23. || ClassConstants.CALENDAR.isAssignableFrom(getAttributeClassification()))) {
  24. setIsMutable(session.getProject().getDefaultTemporalMutable());
  25. }
  26. }
  27. Map nullValues = session.getPlatform(this.descriptor.getJavaClass()).getConversionManager().getDefaultNullValues();
  28. bypassDefaultNullValueCheck = (!this.attributeClassification.isPrimitive()) &&
  29. ((nullValues == null) || (!nullValues.containsKey(this.attributeClassification)));
  30. }

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

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

相关文章

Helper类方法