Methods Summary |
---|
public static oracle.toplink.essentials.descriptors.ClassDescriptor | findDescriptor(oracle.toplink.essentials.sessions.Project project, java.lang.Class cls)INTERNAL:
Search the given sessions list of ordered descriptors for a descriptor
for the class named the same as the given class.
We do not use the session based getDescriptor() methods because they
require the project be initialized with classes. We are avoiding using
a project with loaded classes so the project can be constructed prior to
any class weaving.
for (ClassDescriptor descriptor : (Vector<ClassDescriptor>) project.getOrderedDescriptors()) {
if (descriptor.getJavaClassName().equals(cls.getName())){
return descriptor;
}
}
return null;
|
private static T | getAnnotation(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement, java.lang.ClassLoader loader)INTERNAL:
Method to read an annotation. I think there is a bug in the JDK when
reading annotations from classes. It returns the wrong type. Anyhow,
this method fixes that.
return (T) annotatedElement.getAnnotation(getClassForName(annotation.getName(), loader));
|
public static T | getAnnotation(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Wrapper to the getAnnotation() call to check if we should ignore
annotations.
Annotation loadedAnnotation = getAnnotation(annotation, annotatedElement, descriptor.getJavaClass().getClassLoader());
if (loadedAnnotation != null && descriptor.ignoreAnnotations()) {
descriptor.getLogger().logWarningMessage(MetadataLogger.IGNORE_ANNOTATION, annotation, annotatedElement);
return null;
} else {
return (T) loadedAnnotation;
}
|
public static T | getAnnotation(java.lang.Class annotation, oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.MetadataAccessor accessor)INTERNAL:
Wrapper to the getAnnotation() call using an Accessor.
return (T) getAnnotation(annotation, accessor.getAnnotatedElement(), accessor.getDescriptor());
|
public static T | getAnnotation(java.lang.Class annotation, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Wrapper to the getAnnotation() call using an MetadataDescriptor.
return (T) getAnnotation(annotation, descriptor.getJavaClass(), descriptor);
|
public static java.lang.String | getAttributeNameFromMethodName(java.lang.String methodName)INTERNAL:
Method to convert a getXyz or isXyz method name to an xyz attribute name.
NOTE: The method name passed it may not actually be a method name, so
by default return the name passed in.
String leadingChar = "";
String restOfName = methodName;
if (methodName.startsWith(GET_PROPERTY_METHOD_PREFIX)) {
leadingChar = methodName.substring(POSITION_AFTER_GET_PREFIX, POSITION_AFTER_GET_PREFIX + 1);
restOfName = methodName.substring(POSITION_AFTER_GET_PREFIX + 1);
} else if (methodName.startsWith(IS_PROPERTY_METHOD_PREFIX)){
leadingChar = methodName.substring(POSITION_AFTER_IS_PREFIX, POSITION_AFTER_IS_PREFIX + 1);
restOfName = methodName.substring(POSITION_AFTER_IS_PREFIX + 1);
}
return leadingChar.toLowerCase().concat(restOfName);
|
public static java.lang.reflect.Method[] | getCandidateCallbackMethodsForDefaultListener(oracle.toplink.essentials.internal.ejb.cmp3.metadata.listeners.MetadataEntityListener listener)INTERNAL:
Returns the same candidate methods as an entity listener would.
return getCandidateCallbackMethodsForEntityListener(listener);
|
public static java.lang.reflect.Method[] | getCandidateCallbackMethodsForEntityClass(java.lang.Class entityClass)INTERNAL:
Return only the actual methods declared on this entity class.
return getDeclaredMethods(entityClass);
|
public static java.lang.reflect.Method[] | getCandidateCallbackMethodsForEntityListener(oracle.toplink.essentials.internal.ejb.cmp3.metadata.listeners.MetadataEntityListener listener)INTERNAL:
Returns a list of methods from the given class, which can have private,
protected, package and public access, AND will also return public
methods from superclasses.
HashSet candidateMethods = new HashSet();
Class listenerClass = listener.getListenerClass();
// Add all the declared methods ...
Method[] declaredMethods = getDeclaredMethods(listenerClass);
for (int i = 0; i < declaredMethods.length; i++) {
candidateMethods.add(declaredMethods[i]);
}
// Now add any public methods from superclasses ...
Method[] methods = getMethods(listenerClass);
for (int i = 0; i < methods.length; i++) {
if (candidateMethods.contains(methods[i])) {
continue;
}
candidateMethods.add(methods[i]);
}
return (Method[]) candidateMethods.toArray(new Method[candidateMethods.size()]);
|
public static java.lang.reflect.Method[] | getCandidateCallbackMethodsForMappedSuperclass(java.lang.Class mappedSuperclass, java.lang.Class entityClass)INTERNAL:
Return potential lifecyle callback event methods for a mapped superclass.
We must 'convert' the method to the entity class context before adding it
to the listener.
ArrayList candidateMethods = new ArrayList();
Method[] allMethods = getMethods(entityClass);
Method[] declaredMethods = getDeclaredMethods(mappedSuperclass);
for (int i = 0; i < declaredMethods.length; i++) {
Method method = getMethodForName(allMethods, declaredMethods[i].getName());
if (method != null) {
candidateMethods.add(method);
}
}
return (Method[]) candidateMethods.toArray(new Method[candidateMethods.size()]);
|
public static java.lang.Class | getClassForName(java.lang.String classname, java.lang.ClassLoader loader)INTERNAL:
Load a class from a given class name.
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return (Class) AccessController.doPrivileged(new PrivilegedClassForName(classname, true, loader));
} catch (PrivilegedActionException exception) {
throw ValidationException.unableToLoadClass(classname, exception.getException());
}
} else {
return PrivilegedAccessHelper.getClassForName(classname, true, loader);
}
} catch (ClassNotFoundException exception) {
throw ValidationException.unableToLoadClass(classname, exception);
}
|
public static java.lang.Object | getClassInstance(java.lang.Class cls)INTERNAL:
Create a new instance of the class given.
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return AccessController.doPrivileged(new PrivilegedNewInstanceFromClass(cls));
} catch (PrivilegedActionException exception) {
throw ValidationException.errorInstantiatingClass(cls, exception.getException());
}
} else {
return PrivilegedAccessHelper.newInstanceFromClass(cls);
}
} catch (IllegalAccessException exception) {
throw ValidationException.errorInstantiatingClass(cls, exception);
} catch (InstantiationException exception) {
throw ValidationException.errorInstantiatingClass(cls, exception);
}
|
public static java.lang.Object | getClassInstance(java.lang.String className, java.lang.ClassLoader loader)INTERNAL:
Create a new instance of the class name.
return getClassInstance(getClassForName(className, loader));
|
public static int | getDeclaredAnnotationsCount(java.lang.reflect.AnnotatedElement annotatedElement, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
if (descriptor.ignoreAnnotations()) {
return 0;
} else {
// Look for javax.persistence annotations only.
int count = 0;
for (Annotation annotation : annotatedElement.getDeclaredAnnotations()) {
if (annotation.annotationType().getName().startsWith(PERSISTENCE_PACKAGE_PREFIX)) {
count++;
}
}
return count;
}
|
public static java.lang.reflect.Method[] | getDeclaredMethods(java.lang.Class cls)INTERNAL:
Get the declared methods from a class using the doPriveleged security
access. This call returns all methods (private, protected, package and
public) on the give class ONLY. It does not traverse the superclasses.
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return(Method[])AccessController.doPrivileged(new PrivilegedGetDeclaredMethods(cls));
} catch (PrivilegedActionException exception) {
// we will not get here, there are no checked exceptions in this call
return null;
}
} else {
return oracle.toplink.essentials.internal.security.PrivilegedAccessHelper.getDeclaredMethods(cls);
}
|
public static java.lang.Class | getDiscriminatorType(java.lang.String discriminatorType)INTERNAL:
Return the discriminator type class for the given discriminator type.
if (discriminatorType.equals(MetadataConstants.CHAR)) {
return Character.class;
} else if (discriminatorType.equals(MetadataConstants.STRING)) {
return String.class;
} else if (discriminatorType.equals(MetadataConstants.INTEGER)) {
return Integer.class;
} else {
// Should never hit because of validation.
return null;
}
|
public static java.lang.Class | getFieldClassification(java.lang.String temporalType)INTERNAL:
Return the field classification for the given temporal type.
if (temporalType.equals(MetadataConstants.DATE)) {
return java.sql.Date.class;
} else if (temporalType.equals(MetadataConstants.TIME)) {
return java.sql.Time.class;
} else if (temporalType.equals(MetadataConstants.TIMESTAMP)) {
return java.sql.Timestamp.class;
} else {
// Should never hit because of validation.
return null;
}
|
public static java.lang.reflect.Field | getFieldForName(java.lang.String fieldName, java.lang.Class javaClass)INTERNAL:
Helper method that will return a given field based on the provided attribute name.
Field field = null;
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
field = (Field)AccessController.doPrivileged(new PrivilegedGetField(javaClass, fieldName, false));
} catch (PrivilegedActionException exception) {
return null;
}
} else {
field = PrivilegedAccessHelper.getField(javaClass, fieldName, false);
}
} catch (NoSuchFieldException nsfex) {
return null;
}
return field;
|
public static java.lang.reflect.Field[] | getFields(java.lang.Class cls)INTERNAL:
Get the declared fields from a class using the doPriveleged security
access.
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return (Field[])AccessController.doPrivileged(new PrivilegedGetDeclaredFields(cls));
} catch (PrivilegedActionException exception) {
// no checked exceptions are thrown, so we should not get here
return null;
}
} else {
return PrivilegedAccessHelper.getDeclaredFields(cls);
}
|
public static java.lang.String | getFullyQualifiedTableName(java.lang.String tableName, java.lang.String catalog, java.lang.String schema)INTERNAL:
Returns a fully qualified table name based on the values passed in.
eg. catalog.schema.name
// schema, attach it if specified
if (! schema.equals("")) {
tableName = schema + "." + tableName;
}
// catalog, attach it if specified
if (! catalog.equals("")) {
tableName = catalog + "." + tableName;
}
return tableName;
|
public static java.lang.String | getFullyQualifiedTableName(java.lang.String name, java.lang.String defaultName, java.lang.String catalog, java.lang.String schema)INTERNAL:
Returns a fully qualified table name based on the values passed in.
eg. schema.catalog.name
// check if a name was specified otherwise use the default
String tableName = name;
if (tableName.equals("")) {
tableName = defaultName;
}
return getFullyQualifiedTableName(tableName, catalog, schema);
|
public static java.lang.reflect.Type | getGenericReturnType(java.lang.reflect.Method method)INTERNAL:
Method to return a generic method return type.
// WIP - should use PrivilegedAccessController
return method.getGenericReturnType();
|
public static java.lang.reflect.Type | getGenericType(java.lang.reflect.Field field)INTERNAL:
Method to return a generic field type.
// WIP - should use PrivilegedAccessController
return field.getGenericType();
|
public static java.lang.Class | getMapKeyTypeFromGeneric(java.lang.reflect.Type type)INTERNAL:
Helper method to return the map key type of a generic map.
Example, Map will return String.class.
return (Class) ((ParameterizedType) type).getActualTypeArguments()[0];
|
protected static java.lang.reflect.Method | getMethod(java.lang.String methodName, java.lang.Class cls, java.lang.Class[] params)INTERNAL:
If the methodName passed in is a declared method on cls, then return
the methodName. Otherwise return null to indicate it does not exist.
try {
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return (Method)AccessController.doPrivileged(new PrivilegedGetMethod(cls, methodName, params, true));
} catch (PrivilegedActionException exception) {
return null;
}
} else {
return PrivilegedAccessHelper.getMethod(cls, methodName, params, true);
}
} catch (NoSuchMethodException e1) {
return null;
}
|
public static java.lang.reflect.Method | getMethodForName(java.lang.reflect.Method[] methods, java.lang.String methodName)INTERNAL:
Find the method in the list where method.getName() == methodName.
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
if (method.getName().equals(methodName)) {
return method;
}
}
return null;
|
public static java.lang.reflect.Method | getMethodForPropertyName(java.lang.String propertyName, java.lang.Class cls)INTERNAL:
Method to convert an xyz property name into a getXyz or isXyz method.
Method method;
String leadingChar = String.valueOf(propertyName.charAt(0)).toUpperCase();
String restOfName = propertyName.substring(1);
// Look for a getPropertyName() method
method = getMethod(GET_PROPERTY_METHOD_PREFIX.concat(leadingChar).concat(restOfName), cls, new Class[]{});
if (method == null) {
// Look for an isPropertyName() method
method = getMethod(IS_PROPERTY_METHOD_PREFIX.concat(leadingChar).concat(restOfName), cls, new Class[]{});
}
return method;
|
public static java.lang.reflect.Method[] | getMethods(java.lang.Class cls)INTERNAL:
Get the methods from a class using the doPriveleged security access.
This call returns only public methods from the given class and its
superclasses.
if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){
try {
return (Method[])AccessController.doPrivileged(new PrivilegedGetMethods(cls));
} catch (PrivilegedActionException exception) {
return null;
}
} else {
return PrivilegedAccessHelper.getMethods(cls);
}
|
public static java.lang.Class | getRawClassFromGeneric(java.lang.reflect.Type type)INTERNAL:
Return the raw class of the generic type.
return (Class)(((ParameterizedType) type).getRawType());
|
public static java.lang.Class | getReturnTypeFromGeneric(java.lang.reflect.Type type)INTERNAL:
Helper method to return the type class of a ParameterizedType. This will
handle the case for a generic collection. It now supports multiple types,
e.g. Map
ParameterizedType pType = (ParameterizedType) type;
if (java.util.Map.class.isAssignableFrom((Class) pType.getRawType())) {
return (Class) pType.getActualTypeArguments()[1];
}
return (Class) pType.getActualTypeArguments()[0];
|
public static java.lang.reflect.Method | getSetMethod(java.lang.reflect.Method method, java.lang.Class cls)INTERNAL:
Method to convert a getMethod into a setMethod. This method could return
null if the corresponding set method is not found.
String getMethodName = method.getName();
Class[] params = new Class[] { method.getReturnType() };
if (getMethodName.startsWith(GET_PROPERTY_METHOD_PREFIX)) {
// Replace 'get' with 'set'.
return getMethod(SET_PROPERTY_METHOD_PREFIX + getMethodName.substring(3), cls, params);
}
// methodName.startsWith(IS_PROPERTY_METHOD_PREFIX)
// Check for a setXyz method first, if it exists use it.
Method setMethod = getMethod(SET_PROPERTY_METHOD_PREFIX + getMethodName.substring(2), cls, params);
if (setMethod == null) {
// setXyz method was not found try setIsXyz
return getMethod(SET_IS_PROPERTY_METHOD_PREFIX + getMethodName.substring(2), cls, params);
}
return setMethod;
|
public static boolean | havePersistenceAnnotationsDefined(java.lang.reflect.AnnotatedElement[] annotatedElements)INTERNAL:
for (AnnotatedElement annotatedElement : annotatedElements) {
for (Annotation annotation : annotatedElement.getDeclaredAnnotations()) {
if (annotation.annotationType().getName().startsWith(PERSISTENCE_PACKAGE_PREFIX)) {
return true;
}
}
}
return false;
|
public static boolean | isAnnotationNotPresent(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Indicates whether the specified annotation is actually not present on
the specified class. Used for defaulting. Need this check since the
isAnnotationPresent calls can return a false when true because of the
meta-data complete feature.
return ! isAnnotationPresent(annotation, annotatedElement, descriptor.getJavaClass().getClassLoader());
|
private static boolean | isAnnotationPresent(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement, java.lang.ClassLoader loader)INTERNAL:
Indicates whether the specified annotation is present on the specified
class.
return annotatedElement.isAnnotationPresent(getClassForName(annotation.getName(), loader));
|
public static boolean | isAnnotationPresent(java.lang.Class annotation, java.lang.reflect.AnnotatedElement annotatedElement, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Indicates whether the specified annotation is present on the specified
class.
boolean isAnnotationPresent = isAnnotationPresent(annotation, annotatedElement, descriptor.getJavaClass().getClassLoader());
if (isAnnotationPresent && descriptor.ignoreAnnotations()) {
descriptor.getLogger().logWarningMessage(MetadataLogger.IGNORE_ANNOTATION, annotation, annotatedElement);
return false;
} else {
return isAnnotationPresent;
}
|
public static boolean | isAnnotationPresent(java.lang.Class annotation, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Indicates whether the specified annotation is present on java class
for the given descriptor metadata.
return isAnnotationPresent(annotation, descriptor.getJavaClass(), descriptor);
|
public static boolean | isBasic(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject annotatedAccessor, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this accessor represents a basic mapping.
AnnotatedElement annotatedElement = annotatedAccessor.getAnnotatedElement();
return isAnnotationPresent(Basic.class, annotatedElement, descriptor) ||
isAnnotationPresent(Lob.class, annotatedElement, descriptor) ||
isAnnotationPresent(Temporal.class, annotatedElement, descriptor) ||
isAnnotationPresent(Enumerated.class, annotatedElement, descriptor);
|
public static boolean | isCollectionClass(java.lang.Class cls)INTERNAL:
Method to return whether a class is a collection or not.
return Collection.class.isAssignableFrom(cls);
|
public static boolean | isEmbedded(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject accessibleObject, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this accessor represents an aggregate mapping. True is
returned id and @Embedded is found or if an @Embeddable is found on the
raw/reference class.
AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
if (isAnnotationNotPresent(Embedded.class, annotatedElement, descriptor) && isAnnotationNotPresent(EmbeddedId.class, annotatedElement, descriptor)) {
Class rawClass = accessibleObject.getRawClass();
// Use the class loader from the descriptor's java class and not
// that from the rawClass since it may be an int, String etc. which
// would not have been loaded from the temp loader, hence will not
// find the Embeddable.class.
return (isAnnotationPresent(Embeddable.class, rawClass, descriptor.getJavaClass().getClassLoader()) || descriptor.getProject().hasEmbeddable(rawClass));
} else {
// Still need to make the call since we may need to ignore it
// because of meta-data complete.
return isAnnotationPresent(Embedded.class, annotatedElement, descriptor);
}
|
public static boolean | isEmbeddedId(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject accessibleObject, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this accessor represents an aggregate mapping. True is
returned id and @Embedded is found or if an @Embeddable is found on the
reference class.
return isAnnotationPresent(EmbeddedId.class, accessibleObject.getAnnotatedElement(), descriptor);
|
public static boolean | isGenericCollectionType(java.lang.reflect.Type type)INTERNAL:
Method to return whether a collection type is a generic.
return (type instanceof ParameterizedType);
|
public static boolean | isManyToMany(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject accessibleObject, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this field accessor represents a m-m relationship.
Class rawClass = accessibleObject.getRawClass();
AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
if (isAnnotationPresent(ManyToMany.class, annotatedElement, descriptor)) {
if (MetadataHelper.isSupportedCollectionClass(rawClass)) {
return true;
} else {
descriptor.getValidator().throwInvalidCollectionTypeForRelationship(descriptor.getJavaClass(), rawClass, annotatedElement);
}
}
return false;
|
public static boolean | isManyToOne(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject annotatedAccessor, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this accessor represents a m-1 relationship.
return isAnnotationPresent(ManyToOne.class, annotatedAccessor.getAnnotatedElement(), descriptor);
|
public static boolean | isMapClass(java.lang.Class cls)INTERNAL:
Method to return whether a class is a map or not.
return Map.class.isAssignableFrom(cls);
|
public static boolean | isOneToMany(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject accessibleObject, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this accessor represents a 1-m relationship.
AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
if (isAnnotationNotPresent(OneToMany.class, annotatedElement, descriptor)) {
if (MetadataHelper.isGenericCollectionType(accessibleObject.getRelationType()) &&
MetadataHelper.isSupportedCollectionClass(accessibleObject.getRawClass()) &&
descriptor.getProject().containsDescriptor(accessibleObject.getReferenceClassFromGeneric())) {
descriptor.getLogger().logConfigMessage(MetadataLogger.ONE_TO_MANY_MAPPING, annotatedElement);
return true;
}
} else {
// Still need to make the call since we may need to ignore it
// because of meta-data complete.
if (isAnnotationPresent(OneToMany.class, annotatedElement, descriptor)) {
if (MetadataHelper.isSupportedCollectionClass(accessibleObject.getRawClass())) {
return true;
} else {
descriptor.getValidator().throwInvalidCollectionTypeForRelationship(descriptor.getJavaClass(), accessibleObject.getRawClass(), annotatedElement);
}
}
}
return false;
|
public static boolean | isOneToOne(oracle.toplink.essentials.internal.ejb.cmp3.metadata.accessors.objects.MetadataAccessibleObject accessibleObject, oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataDescriptor descriptor)INTERNAL:
Return true if this accessor represents a 1-1 relationship.
AnnotatedElement annotatedElement = accessibleObject.getAnnotatedElement();
if (isAnnotationNotPresent(OneToOne.class, annotatedElement, descriptor)) {
if (descriptor.getProject().containsDescriptor(accessibleObject.getRawClass()) &&
! isEmbedded(accessibleObject, descriptor)) {
descriptor.getLogger().logConfigMessage(MetadataLogger.ONE_TO_ONE_MAPPING, annotatedElement);
return true;
} else {
return false;
}
} else {
// Still need to make the call since we may need to ignore it
// because of meta-data complete.
return isAnnotationPresent(OneToOne.class, annotatedElement, descriptor);
}
|
public static boolean | isPrimitiveWrapperClass(java.lang.Class cls)INTERNAL:
Returns true is the given class is primitive wrapper type.
return Long.class.isAssignableFrom(cls) ||
Short.class.isAssignableFrom(cls) ||
Float.class.isAssignableFrom(cls) ||
Byte.class.isAssignableFrom(cls) ||
Double.class.isAssignableFrom(cls) ||
Number.class.isAssignableFrom(cls) ||
Boolean.class.isAssignableFrom(cls) ||
Integer.class.isAssignableFrom(cls) ||
Character.class.isAssignableFrom(cls) ||
String.class.isAssignableFrom(cls) ||
java.math.BigInteger.class.isAssignableFrom(cls) ||
java.math.BigDecimal.class.isAssignableFrom(cls) ||
java.util.Date.class.isAssignableFrom(cls) ||
java.util.Calendar.class.isAssignableFrom(cls);
|
public static boolean | isSupportedCollectionClass(java.lang.Class cls)INTERNAL:
Method to return whether a class is a supported Collection. EJB 3.0 spec
currently only supports Collection, Set, List and Map.
return cls.equals(Collection.class) ||
cls.equals(Set.class) ||
cls.equals(List.class) ||
cls.equals(Map.class);
|
public static boolean | isValidAttributeName(java.lang.String attributeName, java.lang.Class javaClass)INTERNAL:
Search the class for an attribute with a name matching 'attributeName'
Field attributes[] = getFields(javaClass);
for (int i = 0; i < attributes.length; i++) {
if (attributes[i].getName().equals(attributeName)) {
return true;
}
}
return false;
|
public static boolean | isValidBlobType(java.lang.Class cls)INTERNAL:
Returns true if the given class is a valid blob type.
return cls.equals(byte[].class) ||
cls.equals(Byte[].class) ||
cls.equals(java.sql.Blob.class);
|
public static boolean | isValidClobType(java.lang.Class cls)INTERNAL:
Returns true if the given class is a valid clob type.
return cls.equals(char[].class) ||
cls.equals(String.class) ||
cls.equals(Character[].class) ||
cls.equals(java.sql.Clob.class);
|
public static boolean | isValidDateType(java.lang.Class cls)INTERNAL:
Returns true is the given class is or extends java.util.Date.
return java.util.Date.class.isAssignableFrom(cls);
|
public static boolean | isValidEnumeratedType(java.lang.Class cls)INTERNAL:
Return true if the given class is a valid enum type.
return cls.isEnum();
|
public static boolean | isValidLobType(java.lang.Class cls)INTERNAL:
Returns true if the given class is a valid lob type.
return isValidClobType(cls) || isValidBlobType(cls);
|
public static boolean | isValidPersistenceMethodName(java.lang.String methodName)INTERNAL:
return methodName.startsWith(GET_PROPERTY_METHOD_PREFIX) || methodName.startsWith(IS_PROPERTY_METHOD_PREFIX);
|
public static boolean | isValidSerializedType(java.lang.Class cls)INTERNAL:
Returns true if the given class is valid for SerializedObjectMapping.
if (cls.isPrimitive()) {
return false;
}
if (isPrimitiveWrapperClass(cls)) {
return false;
}
if (isValidLobType(cls)) {
return false;
}
if (isValidTemporalType(cls)) {
return false;
}
return true;
|
public static boolean | isValidTemporalType(java.lang.Class cls)INTERNAL:
Returns true if the given class is a valid temporal type and must be
marked temporal.
return (cls.equals(java.util.Date.class) ||
cls.equals(java.util.Calendar.class) ||
cls.equals(java.util.GregorianCalendar.class));
|
public static boolean | isValidTimstampVersionLockingType(java.lang.Class cls)INTERNAL:
Returns true if the given class is a valid timestamp locking type.
return (cls.equals(java.sql.Timestamp.class));
|
public static boolean | isValidVersionLockingType(java.lang.Class cls)INTERNAL:
Returns true if the given class is a valid version locking type.
return (cls.equals(int.class) ||
cls.equals(Integer.class) ||
cls.equals(short.class) ||
cls.equals(Short.class) ||
cls.equals(long.class) ||
cls.equals(Long.class));
|
public static boolean | shouldIgnoreAnnotations(java.lang.Class cls, java.util.HashMap metadataDescriptors)INTERNAL:
Indicates whether the class should ignore annotations. Note that such
classes should already have their descriptors with PKs added to
session's project.
MetadataDescriptor descriptor = metadataDescriptors.get(cls);
if (descriptor != null) {
return descriptor.ignoreAnnotations();
} else {
return false;
}
|