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

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

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

/**
 * INTERNAL:
 *    Return whether the container policy is valid for the indirection policy.
 * In this case, the container policy MUST be configured
 * for an IndirectContainer.
 */
protected boolean containerPolicyIsValid() {
  if (Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.IndirectContainer_Class)) {
    return true;
  }
  return false;
}

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

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

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

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

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

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

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

/**
 * INTERNAL:
 *    Return whether the container policy is valid for the indirection policy.
 * In this case, the container policy MUST be configured
 * for an IndirectContainer.
 */
protected boolean containerPolicyIsValid() {
  if (Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.IndirectContainer_Class)) {
    return true;
  }
  return false;
}

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

/**
 * INTERNAL:
 * Validate the container type.
 */
@Override
public boolean isValidContainerType(Class containerType) {
  return Helper.classImplementsInterface(containerType, getInterfaceType());
}

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

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

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

/**
 * INTERNAL:
 * Validate the container type.
 */
@Override
public boolean isValidContainerType(Class containerType) {
  return Helper.classImplementsInterface(containerType, getInterfaceType());
}

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

/**
 * INTERNAL:
 *    Return whether the container policy is valid for the indirection policy.
 * In this case, the container policy MUST be configured
 * for an IndirectContainer.
 */
protected boolean containerPolicyIsValid() {
  if (Helper.classImplementsInterface(this.getContainerClass(), ClassConstants.IndirectContainer_Class)) {
    return true;
  }
  return false;
}

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

/**
 * INTERNAL:
 * Sets a comparator class for this policy to use when instantiating
 * a new SortedSet object.
 */
public void setComparatorClass(Class comparatorClass) {
  if(Helper.classImplementsInterface(comparatorClass, java.util.Comparator.class)){
    m_comparator=(Comparator)Helper.getInstanceFromClass(comparatorClass);
  }else{
    throw ValidationException.invalidComparatorClass(comparatorClass.getName());
  }
  this.comparatorClass=comparatorClass;
}

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

/**
 * INTERNAL:
 * Sets a comparator class for this policy to use when instantiating
 * a new SortedSet object.
 */
public void setComparatorClass(Class comparatorClass) {
  if(Helper.classImplementsInterface(comparatorClass, java.util.Comparator.class)){
    m_comparator=(Comparator)Helper.getInstanceFromClass(comparatorClass);
  }else{
    throw ValidationException.invalidComparatorClass(comparatorClass.getName());
  }
  this.comparatorClass=comparatorClass;
}

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

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

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

/**
 * INTERNAL:
 * Sets a comparator class for this policy to use when instantiating
 * a new SortedSet object.
 */
public void setComparatorClass(Class comparatorClass) {
  if(Helper.classImplementsInterface(comparatorClass, java.util.Comparator.class)){
    m_comparator=(Comparator)Helper.getInstanceFromClass(comparatorClass);
  }else{
    throw ValidationException.invalidComparatorClass(comparatorClass.getName());
  }
  this.comparatorClass=comparatorClass;
}

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

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

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

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

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

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

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

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

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

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

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

/**
 * This method will be used to validate the specified class and return it's instance.
 */
protected static Object buildObjectForClass(Class clazz, Class mustBeImplementedInterface) throws IllegalAccessException, PrivilegedActionException,InstantiationException {
  if(clazz!=null && Helper.classImplementsInterface(clazz,mustBeImplementedInterface)){
    if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
      return AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(clazz));
    } else {
      return PrivilegedAccessHelper.newInstanceFromClass(clazz);
    }
  } else {
    return null;
  }
}

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

/**
 * INTERNAL:
 * Return whether the type is appropriate for the indirection policy.
 * In this case, the attribute type MUST be
 * compatible with the one specified by the ContainerPolicy
 * (i.e. either the container policy class is a subclass of the
 * declared type [jdk1.1] or the container policy class implements
 * the declared interface [jdk1.2]).
 */
protected boolean typeIsValid(Class declaredType) {
  if (Helper.classIsSubclass(this.getContainerClass(), declaredType)) {
    return true;
  }
  if (Helper.classImplementsInterface(this.getContainerClass(), declaredType)) {
    return true;
  }
  return false;
}

相关文章

Helper类方法