Package io.jenkins.plugins.casc
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 ofConfigurator
.- Author:
- Nicolas De Loof
- See Also:
Configurator.describe()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Attribute.Getter<O,T>
Abstracts away how to retrieve attribute value from a 'target' Jenkins object.static interface
Attribute.Setter<O,T>
Abstracts away how to assign a value to a 'target' Jenkins object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Attribute<Owner,Type>
alias(String alias)
static boolean
calculateIfSecret(Class<?> targetClass, String fieldName)
This is a method which tries to guess whether an attribute isSecret
.Attribute
deprecated(boolean deprecated)
CNode
describe(Owner instance, ConfigurationContext context)
CNode
describeForSchema(Owner instance, ConfigurationContext context)
This function is for the JSONSchemaGenerationboolean
equals(Object o)
boolean
equals(Owner o1, Owner o2)
static <O,T>
Optional<Attribute<O,T>>get(Set<Attribute<O,?>> attributes, String name)
List<String>
getAliases()
Attribute.Getter<Owner,Type>
getGetter()
String
getName()
Class<? extends org.kohsuke.accmod.AccessRestriction>[]
getRestrictions()
Attribute.Setter<Owner,Type>
getSetter()
Attribute<Owner,Type>
getter(Attribute.Getter<Owner,Type> getter)
Class
getType()
Type
getValue(Owner target)
int
hashCode()
boolean
isDeprecated()
boolean
isMultiple()
Attribute is actually a Collection of documented typeboolean
isRestricted()
boolean
isSecret(Owner target)
Checks whether an attribute is considered a secret one.Attribute<Owner,Type>
multiple(boolean multiple)
static <T,V>
Attribute.Setter<T,V>noop()
List<String>
possibleValues()
If this attribute is constrained to a limited set of value, here they areAttribute<Owner,Type>
preferredName(String preferredName)
Attribute
restrictions(Class<? extends org.kohsuke.accmod.AccessRestriction>[] restrictions)
Attribute<Owner,Type>
secret(boolean secret)
Sets whether the attribute is secret.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 structureAttribute<Owner,Type>
setter(Attribute.Setter<Owner,Type> setter)
void
setValue(Owner target, Type value)
String
toString()
-
-
-
Method Detail
-
get
public static <O,T> Optional<Attribute<O,T>> get(Set<Attribute<O,?>> attributes, String name)
-
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
-
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()
-
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. Ifnull
, only the attribute metadata is checked- Returns:
true
if the attribute is secret- Since:
- 1.25
-
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 Instancecontext
- Context to be passed- Returns:
- CNode object describing the structure of the node
-
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 isSecret
.- Parameters:
targetClass
- Class of the target object.null
if unknownfieldName
- Field name- Returns:
true
if the attribute is secretfalse
if not or if there is no conclusive answer.
-
noop
public static <T,V> Attribute.Setter<T,V> noop()
-
-