Package io.fabric8.kubernetes.api.model
Class GenericKubernetesResource
- java.lang.Object
-
- io.fabric8.kubernetes.api.model.GenericKubernetesResource
-
- All Implemented Interfaces:
HasMetadata
,KubernetesResource
,Serializable
public class GenericKubernetesResource extends Object implements HasMetadata
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface io.fabric8.kubernetes.api.model.HasMetadata
DNS_LABEL_END, DNS_LABEL_REGEXP, DNS_LABEL_START, FINALIZER_NAME_MATCHER, REQUIRES_NON_NULL_METADATA, REQUIRES_NON_NULL_NAME, REQUIRES_NON_NULL_NAMESPACE
-
-
Constructor Summary
Constructors Constructor Description GenericKubernetesResource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <T> T
get(Object... path)
Allows the retrieval of field values from this Resource for the provided path segments.static <T> T
get(Map<String,Object> root, Object... path)
The same asget(Object...)
, but starting at any root raw objectMap<String,Object>
getAdditionalProperties()
com.fasterxml.jackson.databind.JsonNode
getAdditionalPropertiesNode()
Deprecated.use KubernetesSerialization to convert the additionalPropertiesvoid
setAdditionalProperties(Map<String,Object> additionalProperties)
void
setAdditionalProperty(String name, Object value)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.fabric8.kubernetes.api.model.HasMetadata
addFinalizer, addOwnerReference, addOwnerReference, getApiVersion, getFinalizers, getFullResourceName, getKind, getMetadata, getOwnerReferenceFor, getOwnerReferenceFor, getPlural, getSingular, hasFinalizer, hasOwnerReferenceFor, hasOwnerReferenceFor, initNameAndNamespaceFrom, isFinalizerValid, isMarkedForDeletion, optionalMetadata, removeFinalizer, removeOwnerReference, removeOwnerReference, setApiVersion, setMetadata
-
-
-
-
Method Detail
-
setAdditionalProperties
public void setAdditionalProperties(Map<String,Object> additionalProperties)
-
getAdditionalPropertiesNode
@Deprecated public com.fasterxml.jackson.databind.JsonNode getAdditionalPropertiesNode()
Deprecated.use KubernetesSerialization to convert the additionalProperties
-
get
public <T> T get(Object... path)
Allows the retrieval of field values from this Resource for the provided path segments.If the path segment is of type
Integer
, then we assume that it is an array index to retrieve the value of an entry in the array.If the path segment is of type
String
, then we assume that it is a field name to retrieve the value from the resource.In any other case, the path segment is ignored and considered invalid. The method returns null.
Considering the following JSON object:
{ "field": { "value": 42 "list": [ {entry: 1}, {entry: 2}, {entry: 3} ], "1": "one" } }
The following invocations will produce the documented results:
get("field", "value")
will result in42
get("field", "1")
will result in"one"
get("field", 1)
will result innull
get("field", "list", 1, "entry")
will result in2
get("field", "list", 99, "entry")
will result innull
get("field", "list", "1", "entry")
will result innull
get("field", "list", 1, false)
will result innull
- Type Parameters:
T
- type of the returned object.- Parameters:
path
- of the field to retrieve.- Returns:
- the value of the traversed path or null if the field does not exist.
-
get
public static <T> T get(Map<String,Object> root, Object... path)
The same asget(Object...)
, but starting at any root raw object- Type Parameters:
T
- type of the returned object (Map, Collection, or value).- Parameters:
root
- starting objectpath
- of the field to retrieve.- Returns:
- the value of the traversed path or null if the field does not exist.
-
-