Class PrimitiveClassImpl
- java.lang.Object
-
- org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.AnnotatedElementImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.BuiltinClassImpl
-
- org.apache.xmlbeans.impl.jam.internal.elements.PrimitiveClassImpl
-
- All Implemented Interfaces:
java.lang.Comparable,JAnnotatedElement,JClass,JElement,JMember,MAnnotatedElement,MClass,MElement,MMember
public final class PrimitiveClassImpl extends BuiltinClassImpl
JClass implementation for primitive types.
-
-
Field Summary
-
Fields inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
NO_ANNOTATION, NO_CLASS, NO_COMMENT, NO_CONSTRUCTOR, NO_FIELD, NO_METHOD, NO_NODE, NO_PACKAGE, NO_PARAMETER, NO_PROPERTY
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetFieldDescriptor()Returns the name of this member in the format described in section 4.3.2 of the VM spec, 'Field Descriptors.' This is the same nasty format returned by java.lang.Class.getName(), and is the format you need to use in calls to Class.forName().static java.lang.StringgetFieldDescriptor(java.lang.String classname)Returns the field descriptor for the given name, e.g.java.lang.ClassgetPrimitiveClass()If this JClass represents a primitive (isPrimitiveType() returns true), this method returns the java.lang.Class representing the class of the primitive.static java.lang.ClassgetPrimitiveClass(java.lang.String classname)Returns the primitve class for the given name, e.g.static java.lang.StringgetPrimitiveClassForName(java.lang.String named)Returns the field descriptor for an named primitive, e.g.java.lang.StringgetQualifiedName()Returns a qualified name for this abstraction.booleanisAssignableFrom(JClass c)Determines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter.static booleanisPrimitive(java.lang.String name)Returns true if the named type is a primitive.booleanisPrimitiveType()Return true if this JClass represents primitive type (int, long, double, and so forth).static voidmapNameToPrimitive(ElementContext ctx, java.util.Map out)-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.BuiltinClassImpl
accept, accept, addInterface, addInterface, addInterfaceUnqualified, addNewConstructor, addNewDeclaredProperty, addNewField, addNewInnerClass, addNewMethod, addNewProperty, equals, forName, getArrayComponentType, getArrayDimensions, getClasses, getConstructors, getContainingClass, getContainingPackage, getDeclaredFields, getDeclaredMethods, getDeclaredProperties, getFields, getImportedClasses, getImportedPackages, getInterfaces, getMethods, getModifiers, getMutableConstructors, getMutableFields, getMutableMethods, getProperties, getSourcePosition, getSuperclass, hashCode, isAbstract, isAnnotationType, isArrayType, isBuiltinType, isEnumType, isFinal, isInterface, isObjectType, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isUnresolvedType, isVoidType, removeConstructor, removeDeclaredProperty, removeField, removeInnerClass, removeInterface, removeInterface, removeMethod, removeProperty, setIsAnnotationType, setIsEnumType, setIsInterface, setIsUnresolvedType, setModifiers, setSimpleName, setSuperclass, setSuperclass, setSuperclassUnqualified
-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.AnnotatedElementImpl
addAnnotationForProxy, addLiteralAnnotation, createComment, findOrCreateAnnotation, getAllJavadocTags, getAnnotation, getAnnotation, getAnnotationProxy, getAnnotations, getAnnotationValue, getComment, getEditableProxy, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeAnnotation, removeComment
-
Methods inherited from class org.apache.xmlbeans.impl.jam.internal.elements.ElementImpl
compareTo, createSourcePosition, defaultName, getArtifact, getClassLoader, getContext, getMutableSourcePosition, getParent, getSimpleName, removeSourcePosition, setArtifact, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JAnnotatedElement
getAllJavadocTags, getAnnotation, getAnnotation, getAnnotationProxy, getAnnotations, getAnnotationValue, getComment
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JClass
getClassLoader
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JElement
getArtifact, getParent, getSimpleName, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MAnnotatedElement
addLiteralAnnotation, createComment, findOrCreateAnnotation, getMutableAnnotation, getMutableAnnotations, getMutableComment, removeComment
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MElement
createSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifact
-
-
-
-
Method Detail
-
mapNameToPrimitive
public static void mapNameToPrimitive(ElementContext ctx, java.util.Map out)
-
getPrimitiveClassForName
public static java.lang.String getPrimitiveClassForName(java.lang.String named)
Returns the field descriptor for an named primitive, e.g. 'I' for 'int', or null if the parameter does not name a primitive.
-
isPrimitive
public static boolean isPrimitive(java.lang.String name)
Returns true if the named type is a primitive. The parameter can be a simple type name (e.g. 'int') or a field descriptor (e.g. 'I').
-
getFieldDescriptor
public static final java.lang.String getFieldDescriptor(java.lang.String classname)
Returns the field descriptor for the given name, e.g. 'int' returns 'I'.
-
getPrimitiveClass
public static final java.lang.Class getPrimitiveClass(java.lang.String classname)
Returns the primitve class for the given name, e.g. 'int' returns int.class. It's really stupid that there isn't a way to deal with this built in to java.
-
getQualifiedName
public java.lang.String getQualifiedName()
Description copied from interface:JElementReturns a qualified name for this abstraction. The exact format of this name depends on the particular abstraction. Please refer to the documentation for each JElement subclass for a detailed description of the qualified name formats.
- Specified by:
getQualifiedNamein interfaceJElement- Overrides:
getQualifiedNamein classBuiltinClassImpl
-
getFieldDescriptor
public java.lang.String getFieldDescriptor()
Description copied from interface:JClassReturns the name of this member in the format described in section 4.3.2 of the VM spec, 'Field Descriptors.' This is the same nasty format returned by java.lang.Class.getName(), and is the format you need to use in calls to Class.forName(). For example, the ClassfileName of the class of a two-dimensional array of strings is
[[Ljava.lang.String;. For details, see http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html- Specified by:
getFieldDescriptorin interfaceJClass- Overrides:
getFieldDescriptorin classBuiltinClassImpl
-
isAssignableFrom
public boolean isAssignableFrom(JClass c)
Description copied from interface:JClassDetermines if the class or interface represented by this Class object is either the same as, or is a superclass or superinterface of, the class or interface represented by the specified Class parameter. It returns true if so; otherwise it returns false. If this Class object represents a primitive type, this method returns true if the specified Class parameter is exactly this Class object; otherwise it returns false.
Specifically, this method tests whether the type represented by the specified Class parameter can be converted to the type represented by this Class object via an identity conversion or via a widening reference conversion. See The Java Language Specification, sections 5.1.1 and 5.1.4 , for details.
-
isPrimitiveType
public boolean isPrimitiveType()
Description copied from interface:JClassReturn true if this JClass represents primitive type (int, long, double, and so forth). Remember that primitive wrapper classes such as java.lang.Integer are NOT considered primitives.- Specified by:
isPrimitiveTypein interfaceJClass- Overrides:
isPrimitiveTypein classBuiltinClassImpl
-
getPrimitiveClass
public java.lang.Class getPrimitiveClass()
Description copied from interface:JClassIf this JClass represents a primitive (isPrimitiveType() returns true), this method returns the java.lang.Class representing the class of the primitive. For example, JClass representing an integer returns the equivalent of 'int.class' or 'java.lang.Integer.type.'
- Specified by:
getPrimitiveClassin interfaceJClass- Overrides:
getPrimitiveClassin classBuiltinClassImpl- Returns:
- The primitive class, or null if this is JClass is not primitive.
-
-