Package org.bedework.jsforj.model.values
Interface JSValue
-
- All Known Subinterfaces:
JSAbsoluteTrigger,JSAlert,JSAlerts,JSArray<T>,JSBoolean,JSCalendarObject,JSDateTime,JSDuration,JSEntries,JSEvent,JSGroup,JSIdMap<K,E>,JSInteger,JSLink,JSLinks,JSList<T>,JSLocalDateTime,JSLocation,JSLocations,JSMap<K,E>,JSNDay,JSNull,JSOffsetTrigger,JSOverride,JSParticipant,JSParticipants,JSPatchObject,JSRecurrenceOverrides,JSRecurrenceRule,JSRecurrenceRules,JSRelation,JSRelations,JSReplyTo,JSRoles,JSSendTo,JSSignedDuration,JSString,JSTask,JSTimeZone,JSTimeZoneRule,JSTrigger,JSUnknownTrigger,JSUnknownType,JSUnsignedInteger,JSUTCDateTime,JSVirtualLocation
- All Known Implementing Classes:
JSAbsoluteTriggerImpl,JSAlertImpl,JSAlertsImpl,JSArrayImpl,JSBooleanImpl,JSCalendarObjectImpl,JSDurationImpl,JSEntriesImpl,JSEventImpl,JSGroupImpl,JSIdMapImpl,JSIntArrayImpl,JSIntegerImpl,JSLinkImpl,JSLinksImpl,JSListImpl,JSLocalDateTimeImpl,JSLocationImpl,JSLocationsImpl,JSMapImpl,JSNullImpl,JSOffsetTriggerImpl,JSOverrideImpl,JSParticipantImpl,JSParticipantsImpl,JSPatchObjectImpl,JSRecurrenceOverridesImpl,JSRecurrenceRuleImpl,JSRecurrenceRulesImpl,JSRelationImpl,JSRelationsImpl,JSReplyToImpl,JSRolesImpl,JSSendToImpl,JSSignedDurationImpl,JSStringArrayImpl,JSStringImpl,JSStringListImpl,JSTaskImpl,JSTimeZoneImpl,JSTimeZoneRuleImpl,JSTriggerImpl,JSUnknownTriggerImpl,JSUnknownTypeImpl,JSUnsignedIntArrayImpl,JSUnsignedIntegerImpl,JSUTCDateTimeImpl,JSValueImpl,JSVirtualLocationImpl
public interface JSValueUser: mike Date: 10/24/19 Time: 10:21
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclear()Remove all contained properties and valuesdefault JSValuecopy()Return a deep copy of this valuebooleangetBooleanProperty(String name)Returns value of named boolean property.booleangetBooleanValue()Returns value as a boolean.booleangetChanged()com.fasterxml.jackson.databind.JsonNodegetNode()StringgetObjectType()booleangetOverrideGenerated()JSValuegetOwner()JSProperty<?>getParentProperty()List<JSProperty<?>>getProperties()Return all contained properties<T extends JSValue>
JSProperty<T>getProperty(com.fasterxml.jackson.core.type.TypeReference<T> type, String name)Return named propertyJSProperty<?>getProperty(String name)Return named propertyJSValuegetPropertyValue(String name)Get the value.StringgetStringProperty(String name)Returns value of named String property.StringgetStringValue()Returns value as a String.StringgetType()JSUnsignedIntegergetUnsignedIntegerProperty(String name)Returns value of named UnsignedInteger property.<T extends JSValue>
TgetValue(com.fasterxml.jackson.core.type.TypeReference<T> type, String pname, boolean create)Returns a value of the desired type and adds as a sub-property of this value.booleanhasChanges()booleanhasProperty(String propertyName)booleanisString()<T extends JSValue>
JSProperty<T>makeProperty(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, String name, String type)Add a property of given type.voidmarkOverrideGenerated()Flags this value is being generated for overrides.<T extends JSValue>
JSProperty<T>newProperty(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, String name, String type)Create a property of the given type.voidpreWrite()Called before we output the object.voidremoveProperty(String name)Remove named property throws JsforjException if not an objectJSProperty<?>setProperty(String name, boolean val)Set the value for a boolean type propertyJSProperty<?>setProperty(String name, Integer val)Set the value for an UnsignedInteger type propertyJSProperty<?>setProperty(String name, String val)Set the value for a string type propertyJSProperty<?>setProperty(String name, JSValue val)Set the value for an JSValue type property<ValType extends JSValue>
JSProperty<ValType>setProperty(JSProperty<ValType> val)Add or replace the named propertyvoidwriteValue(Writer wtr, com.fasterxml.jackson.databind.ObjectMapper mapper)Convert to json with this as rootStringwriteValueAsString(com.fasterxml.jackson.databind.ObjectMapper mapper)Convert to json with this as rootStringwriteValueAsStringFormatted(com.fasterxml.jackson.databind.ObjectMapper mapper)Convert to formatted json with this as root
-
-
-
Method Detail
-
markOverrideGenerated
void markOverrideGenerated()
Flags this value is being generated for overrides. Will be skipped when generating patches.
-
getOverrideGenerated
boolean getOverrideGenerated()
- Returns:
- true if this is generated for overrides.
-
getObjectType
String getObjectType()
- Returns:
- type passed to constructor
-
getNode
com.fasterxml.jackson.databind.JsonNode getNode()
- Returns:
- node which currently represents this object
-
preWrite
void preWrite()
Called before we output the object. Objects MUST call all children to allow any processing before output - e.g. generate patches.
-
getChanged
boolean getChanged()
- Returns:
- true if this value was changed - i.e a value was changed or a sub-property added or removed.
-
hasChanges
boolean hasChanges()
- Returns:
- true if this or any sub-value was changed.
-
getOwner
JSValue getOwner()
- Returns:
- next value up in hierarchy
-
getParentProperty
JSProperty<?> getParentProperty()
- Returns:
- property containing this value.
-
getType
String getType()
- Returns:
- the type of the value
-
hasProperty
boolean hasProperty(String propertyName)
- Parameters:
propertyName- to test for- Returns:
- true if value contains named property
-
getProperties
List<JSProperty<?>> getProperties()
Return all contained properties- Returns:
- properties throws JsforjException if not an object
-
getProperty
<T extends JSValue> JSProperty<T> getProperty(com.fasterxml.jackson.core.type.TypeReference<T> type, String name)
Return named property- Parameters:
type- expected typename- of property- Returns:
- property or null throws JsforjException if not an object
-
getProperty
JSProperty<?> getProperty(String name)
Return named property- Parameters:
name- of property- Returns:
- property or null throws JsforjException if not an object
-
copy
default JSValue copy()
Return a deep copy of this value- Returns:
- value
-
removeProperty
void removeProperty(String name)
Remove named property throws JsforjException if not an object
-
clear
void clear()
Remove all contained properties and values
-
setProperty
<ValType extends JSValue> JSProperty<ValType> setProperty(JSProperty<ValType> val)
Add or replace the named property- Parameters:
val- the property - non null- Returns:
- the property
-
setProperty
JSProperty<?> setProperty(String name, String val)
Set the value for a string type property- Parameters:
name- the property name - non nullval- the property value - non null- Returns:
- the property
-
getPropertyValue
JSValue getPropertyValue(String name)
Get the value. Return null if absent.- Parameters:
name- of property- Returns:
- the value or null
-
getBooleanProperty
boolean getBooleanProperty(String name)
Returns value of named boolean property.- Parameters:
name- the property name - non null- Returns:
- the value of the property - false if absent throws JsforjException if not a boolean property
-
getStringProperty
String getStringProperty(String name)
Returns value of named String property.- Parameters:
name- the property name - non null- Returns:
- the value of the property throws JsforjException if not a String property
-
isString
boolean isString()
- Returns:
- true if this is a string
-
setProperty
JSProperty<?> setProperty(String name, JSValue val)
Set the value for an JSValue type property- Parameters:
name- the property name - non nullval- the property value - non null- Returns:
- the property
-
setProperty
JSProperty<?> setProperty(String name, Integer val)
Set the value for an UnsignedInteger type property- Parameters:
name- the property name - non nullval- the property value - non null- Returns:
- the property
-
setProperty
JSProperty<?> setProperty(String name, boolean val)
Set the value for a boolean type property- Parameters:
name- the property name - non nullval- the property value- Returns:
- the property
-
makeProperty
<T extends JSValue> JSProperty<T> makeProperty(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, String name, String type)
Add a property of given type.- Parameters:
name- the property name - non nulltype- the property type- Returns:
- the property throws JsforjException if property already exists
-
newProperty
<T extends JSValue> JSProperty<T> newProperty(com.fasterxml.jackson.core.type.TypeReference<T> typeRef, String name, String type)
Create a property of the given type. NOT added or set- Parameters:
name- the property name - non nulltype- the property type- Returns:
- the property throws JsforjException if property already exists
-
getUnsignedIntegerProperty
JSUnsignedInteger getUnsignedIntegerProperty(String name)
Returns value of named UnsignedInteger property.- Parameters:
name- the property name - non null- Returns:
- the value of the property throws JsforjException if not a String property
-
getStringValue
String getStringValue()
Returns value as a String.- Returns:
- the value of the property throws JsforjException if not a String property
-
getBooleanValue
boolean getBooleanValue()
Returns value as a boolean.- Returns:
- the value of the property throws JsforjException if not a boolean property
-
writeValue
void writeValue(Writer wtr, com.fasterxml.jackson.databind.ObjectMapper mapper)
Convert to json with this as root- Parameters:
wtr- to write tomapper- to convert
-
writeValueAsString
String writeValueAsString(com.fasterxml.jackson.databind.ObjectMapper mapper)
Convert to json with this as root- Parameters:
mapper- to convert- Returns:
- Json
-
writeValueAsStringFormatted
String writeValueAsStringFormatted(com.fasterxml.jackson.databind.ObjectMapper mapper)
Convert to formatted json with this as root- Parameters:
mapper- to convert- Returns:
- Json
-
getValue
<T extends JSValue> T getValue(com.fasterxml.jackson.core.type.TypeReference<T> type, String pname, boolean create)
Returns a value of the desired type and adds as a sub-property of this value.- Type Parameters:
T- type of value- Parameters:
type- referencepname- property namecreate- true if it shoudl be created if absent- Returns:
- value
-
-