Class XJCJavaFieldImpl

java.lang.Object
org.eclipse.persistence.jaxb.javamodel.xjc.XJCJavaFieldImpl
All Implemented Interfaces:
JavaField, JavaHasAnnotations

public class XJCJavaFieldImpl extends Object implements JavaField
INTERNAL:

Purpose: JavaField implementation wrapping XJC's JFieldVar. Used when bootstrapping a DynamicJAXBContext from an XML Schema.

Responsibilities:

  • Provide Field information from the underlying JFieldVar.
See Also:
  • Constructor Details

    • XJCJavaFieldImpl

      public XJCJavaFieldImpl(com.sun.codemodel.JFieldVar javaField, com.sun.codemodel.JCodeModel codeModel, DynamicClassLoader loader, JavaClass owner)
      Construct a new instance of XJCJavaFieldImpl.
      Parameters:
      javaField - - the XJC JFieldVar to be wrapped.
      codeModel - - the XJC JCodeModel this field belongs to.
      loader - - the ClassLoader used to bootstrap the DynamicJAXBContext.
      owner - - the JavaClass this field belongs to.
  • Method Details

    • getAnnotation

      public JavaAnnotation getAnnotation(JavaClass aClass)
      If this JavaField is annotated with an Annotation matching aClass, return its JavaAnnotation representation.
      Specified by:
      getAnnotation in interface JavaHasAnnotations
      Parameters:
      aClass - a JavaClass representing the Annotation to look for.
      Returns:
      the JavaAnnotation represented by aClass, if one exists, otherwise return null.
    • getAnnotations

      public Collection<JavaAnnotation> getAnnotations()
      Return all of the Annotations for this JavaField.
      Specified by:
      getAnnotations in interface JavaHasAnnotations
      Returns:
      A Collection containing this JavaField's JavaAnnotations.
    • getModifiers

      public int getModifiers()
      Returns the Java language modifiers for this JavaField, encoded in an integer.
      Specified by:
      getModifiers in interface JavaField
      Returns:
      the int representing the modifiers for this field.
      See Also:
    • getName

      public String getName()
      Returns the name of this JavaField.
      Specified by:
      getName in interface JavaField
      Returns:
      the String name of this JavaField.
    • getResolvedType

      public JavaClass getResolvedType()
      Returns the JavaClass representing the type of this JavaField.
      Specified by:
      getResolvedType in interface JavaField
      Returns:
      the type of this JavaField as a JavaClass.
    • isFinal

      public boolean isFinal()
      Indicates if this JavaField is final.
      Specified by:
      isFinal in interface JavaField
      Returns:
      true if this JavaField is final, otherwise false.
    • isAbstract

      public boolean isAbstract()
      Indicates if this JavaField is abstract.
      Specified by:
      isAbstract in interface JavaField
      Returns:
      true if this JavaField is abstract, otherwise false.
    • isPrivate

      public boolean isPrivate()
      Indicates if this JavaField is private.
      Specified by:
      isPrivate in interface JavaField
      Returns:
      true if this JavaField is private, otherwise false.
    • isProtected

      public boolean isProtected()
      Indicates if this JavaField is protected.
      Specified by:
      isProtected in interface JavaField
      Returns:
      true if this JavaField is protected, otherwise false.
    • isPublic

      public boolean isPublic()
      Indicates if this JavaField is public.
      Specified by:
      isPublic in interface JavaField
      Returns:
      true if this JavaField is public, otherwise false.
    • isStatic

      public boolean isStatic()
      Indicates if this JavaField is static.
      Specified by:
      isStatic in interface JavaField
      Returns:
      true if this JavaField is static, otherwise false.
    • isSynthetic

      public boolean isSynthetic()
      Not supported.
      Specified by:
      isSynthetic in interface JavaField
    • isEnumConstant

      public boolean isEnumConstant()
      Indicates if this JavaField is an enum constant - i.e. its owner is an enum.
      Specified by:
      isEnumConstant in interface JavaField
      Returns:
      true if this JavaField is an enum constant.
    • getDeclaredAnnotation

      public JavaAnnotation getDeclaredAnnotation(JavaClass aClass)
      If this JavaField is annotated with an Annotation matching aClass, return its JavaAnnotation representation.
      Specified by:
      getDeclaredAnnotation in interface JavaHasAnnotations
      Parameters:
      aClass - a JavaClass representing the Annotation to look for.
      Returns:
      the JavaAnnotation represented by aClass, if one exists, otherwise return null.
    • getDeclaredAnnotations

      public Collection<JavaAnnotation> getDeclaredAnnotations()
      Return all of the Annotations for this JavaField.
      Specified by:
      getDeclaredAnnotations in interface JavaHasAnnotations
      Returns:
      A Collection containing this JavaField's JavaAnnotations.
    • setOwningClass

      public void setOwningClass(JavaClass owningClass)
      Set the JavaClass which contains this field.
      Parameters:
      owningClass - the JavaClass representing the owner of this JavaField.
    • getOwningClass

      public JavaClass getOwningClass()
      Returns the JavaClass which contains this field.
      Returns:
      JavaClass representing the owner of this JavaField.