Class Attribute<Owner,Type>

java.lang.Object
io.jenkins.plugins.casc.Attribute<Owner,Type>
Direct Known Subclasses:
DescribableAttribute, MultivaluedAttribute, PersistedListAttribute

public class Attribute<Owner,Type> extends Object
One attribute of Configurator.
Author:
Nicolas De Loof
See Also:
  • Field Details

    • name

      protected final String name
    • type

      protected final Class type
    • multiple

      protected boolean multiple
    • preferredName

      protected String preferredName
    • aliases

      protected List<String> aliases
  • Constructor Details

  • Method Details

    • get

      public static <O, T> Optional<Attribute<O,T>> get(Set<Attribute<O,?>> attributes, String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
    • getType

      public Class getType()
    • isDeprecated

      public boolean isDeprecated()
    • getRestrictions

      public Class<? extends org.kohsuke.accmod.AccessRestriction>[] getRestrictions()
    • setJsonSchema

      public void setJsonSchema(boolean jsonSchema)
      Set jsonSchema is used to tell the describe function to call the describe structure so that it supports and returns a nested structure
    • isRestricted

      public boolean isRestricted()
    • isMultiple

      public boolean isMultiple()
      Attribute is actually a Collection of documented type
      Returns:
      boolean indicating if this attribute is a list of multiple items of documented type
    • multiple

      public Attribute<Owner,Type> multiple(boolean multiple)
    • preferredName

      public Attribute<Owner,Type> preferredName(String preferredName)
    • setter

      public Attribute<Owner,Type> setter(Attribute.Setter<Owner,Type> setter)
    • alias

      public Attribute<Owner,Type> alias(String alias)
    • getter

      public Attribute<Owner,Type> getter(Attribute.Getter<Owner,Type> getter)
    • secret

      public Attribute<Owner,Type> secret(boolean secret)
      Sets whether the attribute is secret. If so, various outputs will be suppressed (exports, logging).
      Parameters:
      secret - true to make an attribute secret
      Since:
      1.25
    • deprecated

      public Attribute deprecated(boolean deprecated)
    • restrictions

      public Attribute restrictions(Class<? extends org.kohsuke.accmod.AccessRestriction>[] restrictions)
    • getSetter

      public Attribute.Setter<Owner,Type> getSetter()
    • getGetter

      public Attribute.Getter<Owner,Type> getGetter()
    • getAliases

      public List<String> getAliases()
    • possibleValues

      public List<String> possibleValues()
      If this attribute is constrained to a limited set of value, here they are
      Returns:
      A list of possible types
    • isSecret

      public boolean isSecret(@CheckForNull Owner target)
      Checks whether an attribute is considered a secret one.
      Parameters:
      target - Target object. If null, only the attribute metadata is checked
      Returns:
      true if the attribute is secret
      Since:
      1.25
    • setValue

      public void setValue(Owner target, Type value) throws Exception
      Throws:
      Exception
    • getValue

      public Type getValue(Owner target) throws Exception
      Throws:
      Exception
    • describe

      public CNode describe(Owner instance, ConfigurationContext context) throws ConfiguratorException
      Throws:
      ConfiguratorException
    • describeForSchema

      public CNode describeForSchema(Owner instance, ConfigurationContext context)
      This function is for the JSONSchemaGeneration
      Parameters:
      instance - Owner Instance
      context - Context to be passed
      Returns:
      CNode object describing the structure of the node
    • equals

      public boolean equals(Owner o1, Owner o2) throws Exception
      Throws:
      Exception
    • calculateIfSecret

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static boolean calculateIfSecret(@CheckForNull Class<?> targetClass, @NonNull String fieldName)
      This is a method which tries to guess whether an attribute is Secret.
      Parameters:
      targetClass - Class of the target object. null if unknown
      fieldName - Field name
      Returns:
      true if the attribute is secret false if not or if there is no conclusive answer.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • noop

      public static <T, V> Attribute.Setter<T,V> noop()