Interface MClass
-
- All Superinterfaces:
JAnnotatedElement
,JClass
,JElement
,JMember
,MAnnotatedElement
,MElement
,MMember
- All Known Implementing Classes:
ArrayClassImpl
,BuiltinClassImpl
,ClassImpl
,PrimitiveClassImpl
,UnresolvedClassImpl
,VoidClassImpl
public interface MClass extends MMember, JClass
Mutable version of JClass.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addInterface(java.lang.String className)
Adds to the list of interfaces implemented by this class.void
addInterface(JClass interf)
Adds to the list of interfaces implemented by this class.void
addInterfaceUnqualified(java.lang.String unqualifiedClassName)
Adds to the list of interfaces implemented by this class.MConstructor
addNewConstructor()
Creates a new constructor, adds it to this class, and returns it.JProperty
addNewDeclaredProperty(java.lang.String name, JMethod getter, JMethod setter)
MField
addNewField()
Creates a new field, adds it to this class, and returns it.MClass
addNewInnerClass(java.lang.String name)
MMethod
addNewMethod()
Creates a new method, adds it to this class, and returns it.JProperty
addNewProperty(java.lang.String name, JMethod getter, JMethod setter)
MConstructor[]
getMutableConstructors()
Returns the constructors declared on this class.MField[]
getMutableFields()
Returns the fields declared on this class.MMethod[]
getMutableMethods()
Returns the EditableMethods declared on this class.void
removeConstructor(MConstructor constr)
Removes a constructor from this class.void
removeDeclaredProperty(JProperty prop)
void
removeField(MField field)
Removes the given field from this class.void
removeInnerClass(MClass clazz)
void
removeInterface(java.lang.String className)
Removes a named interface from the list of interfaces implemented by this class.void
removeInterface(JClass interf)
Removes an interface from the list of interfaces implemented by this class.void
removeMethod(MMethod method)
Removes the given method from this class.void
removeProperty(JProperty prop)
void
setIsAnnotationType(boolean b)
void
setIsEnumType(boolean b)
void
setIsInterface(boolean b)
void
setSuperclass(java.lang.String qualifiedClassName)
Sets the class which this class extends.void
setSuperclass(JClass clazz)
Sets the class which this class extends.void
setSuperclassUnqualified(java.lang.String unqualifiedClassName)
Sets the name of this class that this class extends.-
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
equals, forName, getArrayComponentType, getArrayDimensions, getClasses, getClassLoader, getConstructors, getContainingClass, getContainingPackage, getDeclaredFields, getDeclaredMethods, getDeclaredProperties, getFieldDescriptor, getFields, getImportedClasses, getImportedPackages, getInterfaces, getMethods, getPrimitiveClass, getProperties, getSuperclass, isAbstract, isAnnotationType, isArrayType, isAssignableFrom, isBuiltinType, isEnumType, isFinal, isInterface, isObjectType, isPrimitiveType, isStatic, isUnresolvedType, isVoidType
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JElement
accept, getArtifact, getParent, getQualifiedName, getSimpleName, getSourcePosition, toString
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.JMember
getModifiers, isPackagePrivate, isPrivate, isProtected, isPublic
-
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
accept, createSourcePosition, getClassLoader, getMutableSourcePosition, removeSourcePosition, setArtifact, setSimpleName
-
Methods inherited from interface org.apache.xmlbeans.impl.jam.mutable.MMember
setModifiers
-
-
-
-
Method Detail
-
setIsInterface
void setIsInterface(boolean b)
-
setIsAnnotationType
void setIsAnnotationType(boolean b)
-
setIsEnumType
void setIsEnumType(boolean b)
-
setSuperclass
void setSuperclass(java.lang.String qualifiedClassName)
Sets the class which this class extends. The class name must be fully- qualified. Pass null to make the class extend nothing.- Throws:
java.lang.IllegalArgumentException
- if the name is not a valid class name.
-
setSuperclassUnqualified
void setSuperclassUnqualified(java.lang.String unqualifiedClassName)
Sets the name of this class that this class extends. The name may or may nor be fully-qualified. Pass null to make the class extend nothing.- Throws:
java.lang.IllegalArgumentException
- if the name is not a valid class name.
-
setSuperclass
void setSuperclass(JClass clazz)
Sets the class which this class extends. Pass null to make the class extend nothing.- Throws:
java.lang.IllegalArgumentException
- if the given class cannot be extended (i.e. final classes, interfaces, void, primitives, arrays).
-
addInterface
void addInterface(java.lang.String className)
Adds to the list of interfaces implemented by this class.- Throws:
java.lang.IllegalArgumentException
- if the parameter is null or is not a valid class name.
-
addInterfaceUnqualified
void addInterfaceUnqualified(java.lang.String unqualifiedClassName)
Adds to the list of interfaces implemented by this class. The class name may or may not be qualified.- Throws:
java.lang.IllegalArgumentException
- if the parameter is null or is not a valid class name.
-
addInterface
void addInterface(JClass interf)
Adds to the list of interfaces implemented by this class.- Throws:
java.lang.IllegalArgumentException
- if the given class cannot be implemented (i.e. is not an interface).
-
removeInterface
void removeInterface(java.lang.String className)
Removes a named interface from the list of interfaces implemented by this class. Does nothing if the class does not implement the named interface.- Throws:
java.lang.IllegalArgumentException
- if the parameter is null or is not a valid class name.
-
removeInterface
void removeInterface(JClass interf)
Removes an interface from the list of interfaces implemented by this class. Does nothing if the class does not implement the named interface.- Throws:
java.lang.IllegalArgumentException
- if the parameter is null or is not an interface.
-
addNewConstructor
MConstructor addNewConstructor()
Creates a new constructor, adds it to this class, and returns it.
-
removeConstructor
void removeConstructor(MConstructor constr)
Removes a constructor from this class. Does nothing if the given constructor is not on this class.
-
getMutableConstructors
MConstructor[] getMutableConstructors()
Returns the constructors declared on this class. This does not include constructors from any base class or interface. This is simply a more strongly-typed version of getDeclaredConstructors().
-
addNewField
MField addNewField()
Creates a new field, adds it to this class, and returns it. The type of the field must be qualified
-
removeField
void removeField(MField field)
Removes the given field from this class. Does nothing if this class does not contain the field.
-
getMutableFields
MField[] getMutableFields()
Returns the fields declared on this class. This does not include fields from any base class or interface. This is simply a more strongly-typed version of getDeclaredFields().
-
addNewMethod
MMethod addNewMethod()
Creates a new method, adds it to this class, and returns it.
-
removeMethod
void removeMethod(MMethod method)
Removes the given method from this class. Does nothing if this class does not contain the method.
-
getMutableMethods
MMethod[] getMutableMethods()
Returns the EditableMethods declared on this class. This does not include methods inherited from any base class or interface. This is simply a more strongly-typed version of getDeclaredMethods().
-
removeProperty
void removeProperty(JProperty prop)
-
addNewDeclaredProperty
JProperty addNewDeclaredProperty(java.lang.String name, JMethod getter, JMethod setter)
-
removeDeclaredProperty
void removeDeclaredProperty(JProperty prop)
-
addNewInnerClass
MClass addNewInnerClass(java.lang.String name)
-
removeInnerClass
void removeInnerClass(MClass clazz)
-
-