Class FieldDefinition

    • Constructor Detail

      • FieldDefinition

        public FieldDefinition​(@Nonnull
                               java.lang.String since,
                               @Nonnull
                               java.lang.String declaredClassName,
                               @Nonnull
                               java.lang.String fieldName)
        Parameters:
        since - the 'since' version
        declaredClassName - the name of declared class
        fieldName - the field name
      • FieldDefinition

        public FieldDefinition​(@Nonnull
                               java.lang.String since,
                               @Nullable
                               Deprecation deprecation,
                               @Nonnull
                               java.lang.String declaredClassName,
                               @Nonnull
                               java.lang.String fieldName)
        Parameters:
        since - the 'since' version
        deprecation - the deprecation
        declaredClassName - the name of declared class
        fieldName - the field name
      • FieldDefinition

        public FieldDefinition​(@Nonnull
                               Version since,
                               @Nonnull
                               java.lang.String declaredClassName,
                               @Nonnull
                               java.lang.String fieldName)
        Parameters:
        since - the 'since' version
        declaredClassName - the name of declared class
        fieldName - the field name
      • FieldDefinition

        public FieldDefinition​(@Nonnull
                               Version since,
                               @Nullable
                               Deprecation deprecation,
                               @Nonnull
                               java.lang.String declaredClassName,
                               @Nonnull
                               java.lang.String fieldName)
        Parameters:
        since - the 'since' version
        deprecation - the deprecation
        declaredClassName - the name of declared class
        fieldName - the field name
    • Method Detail

      • resolveMember

        protected java.lang.reflect.Field resolveMember()
        Description copied from class: MemberDefinition
        Resolve the member instance
        Specified by:
        resolveMember in class MemberDefinition<java.lang.reflect.Field>
        Returns:
        null if can't be resolved
      • getFieldName

        @Nonnull
        public java.lang.String getFieldName()
      • getResolvedField

        @Nullable
        public java.lang.reflect.Field getResolvedField()
      • get

        public <T> T get​(java.lang.Object instance)
                  throws java.lang.IllegalStateException,
                         java.lang.IllegalArgumentException
        Get the field value
        Type Parameters:
        T - the field type
        Parameters:
        instance - the instance
        Returns:
        null
        Throws:
        java.lang.IllegalStateException - if this Field object is enforcing Java language access control and the underlying field is inaccessible.
        java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof).
      • set

        public <T> T set​(java.lang.Object instance,
                         T fieldValue)
        Set the field value
        Type Parameters:
        T - the field type
        Parameters:
        instance - the instance
        fieldValue - the value of field to be set
        Returns:
        the previous value of the specified Field
        Throws:
        java.lang.IllegalStateException - if this Field object is enforcing Java language access control and the underlying field is inaccessible.
        java.lang.IllegalArgumentException - if the specified object is not an instance of the class or interface declaring the underlying field (or a subclass or implementor thereof).