public interface HasMetadata extends KubernetesResource
KubernetesResource
which possesses a ObjectMeta
and is associated with a kind and API version.Modifier and Type | Field and Description |
---|---|
static String |
DNS_LABEL_END |
static String |
DNS_LABEL_REGEXP |
static String |
DNS_LABEL_START |
static Pattern |
FINALIZER_NAME_MATCHER
Pattern that checks the format of finalizer identifiers, which should be in
<domain name>/<finalizer name> format. |
Modifier and Type | Method and Description |
---|---|
default boolean |
addFinalizer(String finalizer)
Adds the specified finalizer to this
HasMetadata if it's valid. |
default String |
getApiVersion() |
static String |
getApiVersion(Class<?> clazz)
Computes the
apiVersion associated with this HasMetadata implementation. |
static String |
getGroup(Class<?> clazz)
Retrieves the group associated with the specified HasMetadata as defined by the
Group annotation. |
default String |
getKind() |
static String |
getKind(Class<?> clazz)
Retrieves the kind associated with the specified HasMetadata implementation.
|
ObjectMeta |
getMetadata() |
default String |
getPlural() |
static String |
getPlural(Class<?> clazz)
Retrieves the plural form associated with the specified class if annotated with
Plural or computes a default value using the value returned by getSingular(Class) as
input to Pluralize.toPlural(String) . |
default String |
getSingular() |
static String |
getSingular(Class<?> clazz)
Retrieves the singular form associated with the specified class as defined by the
Singular annotation or computes a default value (lower-cased version of the value
returned by getKind(Class) ) if the annotation is not present. |
static String |
getVersion(Class<?> clazz)
Retrieves the version associated with the specified HasMetadata as defined by the
Version annotation. |
default boolean |
hasFinalizer(String finalizer)
Determines whether this
HasMetadata holds the specified finalizer. |
default boolean |
isFinalizerValid(String finalizer)
Determines whether the specified finalizer is valid according to the
finalizer specification.
|
default boolean |
isMarkedForDeletion()
Determines whether this
HasMetadata is marked for deletion or not. |
default boolean |
removeFinalizer(String finalizer)
Removes the specified finalizer if it's held by this
HasMetadata . |
void |
setApiVersion(String version) |
void |
setMetadata(ObjectMeta metadata) |
static final String DNS_LABEL_START
static final String DNS_LABEL_END
static final String DNS_LABEL_REGEXP
static final Pattern FINALIZER_NAME_MATCHER
<domain name>/<finalizer name>
format.ObjectMeta getMetadata()
void setMetadata(ObjectMeta metadata)
static String getKind(Class<?> clazz)
Kind
, the annotation value will be used, otherwise the value will be derived from the class name.clazz
- the HasMetadata implementation whose Kind we want to retrievedefault String getKind()
static String getApiVersion(Class<?> clazz)
apiVersion
associated with this HasMetadata implementation. The value is derived from the
Group
and Version
annotations.clazz
- the HasMetadata whose apiVersion
we want to computeapiVersion
or null
if neither Group
or Version
annotations are presentIllegalArgumentException
- if only one of Group
or Version
is providedstatic String getGroup(Class<?> clazz)
Group
annotation.clazz
- the HasMetadata whose group we want to retrievenull
if the HasMetadata is not annotated with Group
static String getVersion(Class<?> clazz)
Version
annotation.clazz
- the HasMetadata whose version we want to retrievenull
if the HasMetadata is not annotated with Version
default String getApiVersion()
void setApiVersion(String version)
static String getPlural(Class<?> clazz)
Plural
or computes a default value using the value returned by getSingular(Class)
as
input to Pluralize.toPlural(String)
.clazz
- the CustomResource whose plural form we want to retrievePlural
annotation or a computed default valuedefault String getPlural()
static String getSingular(Class<?> clazz)
Singular
annotation or computes a default value (lower-cased version of the value
returned by getKind(Class)
) if the annotation is not present.clazz
- the class whose singular form we want to retrieveSingular
annotation or a computed default
valuedefault String getSingular()
default boolean isMarkedForDeletion()
HasMetadata
is marked for deletion or not.true
if the cluster marked this HasMetadata
for deletion, false
otherwisedefault boolean hasFinalizer(String finalizer)
HasMetadata
holds the specified finalizer.finalizer
- the identifier of the finalizer we want to checktrue
if this HasMetadata
holds the specified finalizer, false
otherwisedefault boolean addFinalizer(String finalizer)
HasMetadata
if it's valid. See isFinalizerValid(String)
.finalizer
- the identifier of the finalizer to add to this HasMetadata
in <domain name>/<finalizer name>
format.true
if the finalizer was successfully added, false
otherwise (in particular, if the object is marked for deletion)IllegalArgumentException
- if the specified finalizer identifier is null or is invaliddefault boolean isFinalizerValid(String finalizer)
finalizer
- the identifier of the finalizer which validity we want to checktrue
if the identifier is valid, false
otherwisedefault boolean removeFinalizer(String finalizer)
HasMetadata
.finalizer
- the identifier of the finalizer we want to removetrue
if the finalizer was successfully removed, false
otherwiseCopyright © 2015–2020 Red Hat. All rights reserved.