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

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

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

Helper.classImplementsInterface介绍

[英]INTERNAL: Return whether a Class implements a specific interface, either directly or indirectly (through interface or implementation inheritance).
[中]

代码示例

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the container policy is valid for the indirection policy.
  4. * In this case, the container policy MUST be configured
  5. * for an IndirectContainer.
  6. */
  7. protected boolean containerPolicyIsValid() {
  8. if (Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.IndirectContainer_Class)) {
  9. return true;
  10. }
  11. return false;
  12. }

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the collection has order.
  4. * SortedSets cannot be indexed, but they are order-sensitive.
  5. */
  6. public boolean hasOrder() {
  7. return Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.SortedSet_Class);
  8. }

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the collection has order.
  4. * SortedSets cannot be indexed, but they are order-sensitive.
  5. */
  6. public boolean hasOrder() {
  7. return Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.SortedSet_Class);
  8. }

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

  1. /**
  2. * INTERNAL:
  3. * Validate the container type.
  4. */
  5. public boolean isValidContainerType(Class containerType) {
  6. return org.eclipse.persistence.internal.helper.Helper.classImplementsInterface(containerType, getInterfaceType());
  7. }

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the container policy is valid for the indirection policy.
  4. * In this case, the container policy MUST be configured
  5. * for an IndirectContainer.
  6. */
  7. protected boolean containerPolicyIsValid() {
  8. if (Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.IndirectContainer_Class)) {
  9. return true;
  10. }
  11. return false;
  12. }

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

  1. /**
  2. * INTERNAL:
  3. * Validate the container type.
  4. */
  5. @Override
  6. public boolean isValidContainerType(Class containerType) {
  7. return Helper.classImplementsInterface(containerType, getInterfaceType());
  8. }

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the collection has order.
  4. * SortedSets cannot be indexed, but they are order-sensitive.
  5. */
  6. public boolean hasOrder() {
  7. return Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.SortedSet_Class);
  8. }

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

  1. /**
  2. * INTERNAL:
  3. * Validate the container type.
  4. */
  5. @Override
  6. public boolean isValidContainerType(Class containerType) {
  7. return Helper.classImplementsInterface(containerType, getInterfaceType());
  8. }

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the container policy is valid for the indirection policy.
  4. * In this case, the container policy MUST be configured
  5. * for an IndirectContainer.
  6. */
  7. protected boolean containerPolicyIsValid() {
  8. if (Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.IndirectContainer_Class)) {
  9. return true;
  10. }
  11. return false;
  12. }

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

  1. /**
  2. * INTERNAL:
  3. * Sets a comparator class for this policy to use when instantiating
  4. * a new SortedSet object.
  5. */
  6. public void setComparatorClass(Class comparatorClass) {
  7. if(Helper.classImplementsInterface(comparatorClass, java.util.Comparator.class)){
  8. m_comparator=(Comparator)Helper.getInstanceFromClass(comparatorClass);
  9. }else{
  10. throw ValidationException.invalidComparatorClass(comparatorClass.getName());
  11. }
  12. this.comparatorClass=comparatorClass;
  13. }

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

  1. /**
  2. * INTERNAL:
  3. * Sets a comparator class for this policy to use when instantiating
  4. * a new SortedSet object.
  5. */
  6. public void setComparatorClass(Class comparatorClass) {
  7. if(Helper.classImplementsInterface(comparatorClass, java.util.Comparator.class)){
  8. m_comparator=(Comparator)Helper.getInstanceFromClass(comparatorClass);
  9. }else{
  10. throw ValidationException.invalidComparatorClass(comparatorClass.getName());
  11. }
  12. this.comparatorClass=comparatorClass;
  13. }

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

  1. public void useMapClass(Class concreteMapClass) {
  2. if (!Helper.classImplementsInterface(concreteMapClass, Map.class)) {
  3. throw DescriptorException.illegalContainerClass(concreteMapClass);
  4. }
  5. this.containerPolicy.setContainerClass(concreteMapClass);
  6. }

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

  1. /**
  2. * INTERNAL:
  3. * Sets a comparator class for this policy to use when instantiating
  4. * a new SortedSet object.
  5. */
  6. public void setComparatorClass(Class comparatorClass) {
  7. if(Helper.classImplementsInterface(comparatorClass, java.util.Comparator.class)){
  8. m_comparator=(Comparator)Helper.getInstanceFromClass(comparatorClass);
  9. }else{
  10. throw ValidationException.invalidComparatorClass(comparatorClass.getName());
  11. }
  12. this.comparatorClass=comparatorClass;
  13. }

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

  1. public void useMapClass(Class concreteMapClass) {
  2. if (!Helper.classImplementsInterface(concreteMapClass, Map.class)) {
  3. throw DescriptorException.illegalContainerClass(concreteMapClass);
  4. }
  5. this.containerPolicy.setContainerClass(concreteMapClass);
  6. }

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

  1. public void useMapClass(Class concreteMapClass) {
  2. if (!Helper.classImplementsInterface(concreteMapClass, Map.class)) {
  3. throw DescriptorException.illegalContainerClass(concreteMapClass);
  4. }
  5. this.containerPolicy.setContainerClass(concreteMapClass);
  6. }

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

  1. /**
  2. * PUBLIC:
  3. * Configure the mapping to use an instance of the specified container class
  4. * to hold the target objects.
  5. * <p>The default container class is java.util.Hashtable.
  6. * <p>The container class must implements (directly or indirectly) the Map interface.
  7. * <p>Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will override the previous one.
  8. */
  9. public void useMapClass(Class concreteClass) {
  10. if (!Helper.classImplementsInterface(concreteClass, ClassConstants.Map_Class)) {
  11. throw DescriptorException.illegalContainerClass(concreteClass);
  12. }
  13. containerPolicy.setContainerClass(concreteClass);
  14. }

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

  1. /**
  2. * PUBLIC:
  3. * Configure the mapping to use an instance of the specified container class
  4. * to hold the target objects.
  5. * <p>The default container class is java.util.Hashtable.
  6. * <p>The container class must implements (directly or indirectly) the Map interface.
  7. * <p>Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will override the previous one.
  8. */
  9. public void useMapClass(Class concreteClass) {
  10. if (!Helper.classImplementsInterface(concreteClass, ClassConstants.Map_Class)) {
  11. throw DescriptorException.illegalContainerClass(concreteClass);
  12. }
  13. containerPolicy.setContainerClass(concreteClass);
  14. }

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

  1. /**
  2. * PUBLIC:
  3. * Configure the mapping to use an instance of the specified container class
  4. * to hold the target objects.
  5. * <p>The default container class is java.util.Hashtable.
  6. * <p>The container class must implements (directly or indirectly) the Map interface.
  7. * <p>Note: Do not use both useMapClass(Class concreteClass), useTransparentMap(). The last use of one of the two methods will override the previous one.
  8. */
  9. @Override
  10. public void useMapClass(Class concreteClass) {
  11. if (!Helper.classImplementsInterface(concreteClass, ClassConstants.Map_Class)) {
  12. throw DescriptorException.illegalContainerClass(concreteClass);
  13. }
  14. containerPolicy.setContainerClass(concreteClass);
  15. }

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

  1. /**
  2. * This method will be used to validate the specified class and return it's instance.
  3. */
  4. protected static Object buildObjectForClass(Class clazz, Class mustBeImplementedInterface) throws IllegalAccessException, PrivilegedActionException,InstantiationException {
  5. if(clazz!=null && Helper.classImplementsInterface(clazz,mustBeImplementedInterface)){
  6. if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
  7. return AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(clazz));
  8. } else {
  9. return PrivilegedAccessHelper.newInstanceFromClass(clazz);
  10. }
  11. } else {
  12. return null;
  13. }
  14. }

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

  1. /**
  2. * INTERNAL:
  3. * Return whether the type is appropriate for the indirection policy.
  4. * In this case, the attribute type MUST be
  5. * compatible with the one specified by the ContainerPolicy
  6. * (i.e. either the container policy class is a subclass of the
  7. * declared type [jdk1.1] or the container policy class implements
  8. * the declared interface [jdk1.2]).
  9. */
  10. protected boolean typeIsValid(Class declaredType) {
  11. if (Helper.classIsSubclass(this.getContainerClass(), declaredType)) {
  12. return true;
  13. }
  14. if (Helper.classImplementsInterface(this.getContainerClass(), declaredType)) {
  15. return true;
  16. }
  17. return false;
  18. }

相关文章

Helper类方法