All Downloads are FREE. Search and download functionalities are using the official Maven repository.

public.javadoc.org.spincast.core.json.JsonObjectArrayBase.html Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version






JsonObjectArrayBase (org.spincast:spincast-framework 1.0.0 API)












org.spincast.core.json

Class JsonObjectArrayBase

    • Field Detail

      • logger

        protected final org.slf4j.Logger logger
      • defaultElementValidator

        protected final Object defaultElementValidator
    • Method Detail

      • getJsonManager

        protected JsonManager getJsonManager()
      • getdefaultElementValidator

        protected Object getdefaultElementValidator()
      • getObject

        public Object getObject(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Gets an untyped Object using the specified JsonPath.
        Specified by:
        getObject in interface JsonObjectOrArray
        Returns:
        the object or null if not found. This object will necessarily be of a type managed by JsonObjectOrArray, since an object of any other type is automatically converted when added.
      • getObject

        public Object getObject(String jsonPath,
                                Object defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets an untyped Object using the specified JsonPath.
        Specified by:
        getObject in interface JsonObjectOrArray
        Returns:
        the object or the specified defaultElement if not found. This object will necessarily be of a type managed by JsonObjectOrArray, since an object of any other type is automatically converted when added.
      • getObjectNoKeyParsing

        public Object getObjectNoKeyParsing(String jsonPath)
      • getObjectNoKeyParsing

        public Object getObjectNoKeyParsing(String jsonPath,
                                            Object defaultElement)
      • getObject

        protected Object getObject(String jsonPath,
                                   boolean hasdefaultElement,
                                   Object defaultElement,
                                   boolean parseJsonPath)
      • getJsonObjectOrEmpty

        public JsonObject getJsonObjectOrEmpty(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Gets an element as JsonObject using the specified JsonPath.
        Specified by:
        getJsonObjectOrEmpty in interface JsonObjectOrArray
        Returns:
        the element or an empty JsonObject if not found or if null. The empty JsonObject will not be added to the specified path.
      • getJsonObjectOrEmpty

        public JsonObject getJsonObjectOrEmpty(String jsonPath,
                                               boolean addIfDoesntExist)
        Description copied from interface: JsonObjectOrArray
        Gets an element as JsonObject using the specified JsonPath.
        Specified by:
        getJsonObjectOrEmpty in interface JsonObjectOrArray
        addIfDoesntExist - if true and the element doesn't exist, the created empty JsonObject will be added to the specified JsonPath.
        Returns:
        the element or an empty JsonObject if not found or if null.
      • getJsonObjectNoKeyParsing

        public JsonObject getJsonObjectNoKeyParsing(String jsonPath)
      • getJsonObjectOrEmptyNoKeyParsing

        public JsonObject getJsonObjectOrEmptyNoKeyParsing(String jsonPath)
      • getJsonObject

        protected JsonObject getJsonObject(String jsonPath,
                                           boolean hasdefaultElement,
                                           JsonObject defaultElement,
                                           boolean parseJsonPath)
      • getJsonObjectFromObject

        protected JsonObject getJsonObjectFromObject(Object object)
      • getJsonArrayOrEmpty

        public JsonArray getJsonArrayOrEmpty(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Gets an element as JsonArray using the specified JsonPath.
        Specified by:
        getJsonArrayOrEmpty in interface JsonObjectOrArray
        Returns:
        the element or an empty JsonArray if not found or if null. The empty JsonArray will not be added to the specified path.
      • getJsonArrayOrEmpty

        public JsonArray getJsonArrayOrEmpty(String jsonPath,
                                             boolean addIfDoesntExist)
        Description copied from interface: JsonObjectOrArray
        Gets an element as JsonArray using the specified JsonPath.
        Specified by:
        getJsonArrayOrEmpty in interface JsonObjectOrArray
        addIfDoesntExist - if true and the element doesn't exist, the created empty JsonArray will be added to the specified JsonPath.
        Returns:
        the element or an empty JsonArray if not found or if null.
      • getJsonArrayNoKeyParsing

        public JsonArray getJsonArrayNoKeyParsing(String jsonPath)
      • getJsonArrayOrEmptyNoKeyParsing

        public JsonArray getJsonArrayOrEmptyNoKeyParsing(String jsonPath)
      • getJsonArray

        protected JsonArray getJsonArray(String jsonPath,
                                         boolean hasdefaultElement,
                                         JsonArray defaultElement,
                                         boolean parseJsonPath)
      • getJsonArrayFromObject

        protected JsonArray getJsonArrayFromObject(Object object)
      • getString

        public String getString(String jsonPath,
                                String defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets an element as String using the specified JsonPath.
        Specified by:
        getString in interface JsonObjectOrArray
        Returns:
        the element or the specified defaultElement if not found.
      • getString

        protected String getString(String jsonPath,
                                   boolean hasdefaultElement,
                                   String defaultElement)
      • getStringNoKeyParsing

        public String getStringNoKeyParsing(String jsonPath)
      • getStringNoKeyParsing

        public String getStringNoKeyParsing(String jsonPath,
                                            String defaultElement)
      • getString

        protected String getString(String jsonPath,
                                   boolean hasdefaultElement,
                                   String defaultElement,
                                   boolean parseJsonPath)
      • getStringFromObject

        protected String getStringFromObject(Object object)
      • getIntegerElement

        protected Integer getIntegerElement(String jsonPath,
                                            boolean hasdefaultElement,
                                            Integer defaultElement)
      • getIntegerNoKeyParsing

        public Integer getIntegerNoKeyParsing(String jsonPath)
      • getIntegerNoKeyParsing

        public Integer getIntegerNoKeyParsing(String jsonPath,
                                              Integer defaultElement)
      • getInteger

        protected Integer getInteger(String jsonPath,
                                     boolean hasdefaultElement,
                                     Integer defaultElement,
                                     boolean parseJsonPath)
      • getIntegerFromObject

        protected Integer getIntegerFromObject(Object object)
      • getLong

        public Long getLong(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Gets an element as Long using the specified JsonPath.
        Specified by:
        getLong in interface JsonObjectOrArray
        Returns:
        the element or null if not found.
      • getLong

        public Long getLong(String jsonPath,
                            Long defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets an element as Long using the specified JsonPath.
        Specified by:
        getLong in interface JsonObjectOrArray
        Returns:
        the element or the specified defaultElement if not found.
      • getLongElement

        protected Long getLongElement(String jsonPath,
                                      boolean hasdefaultElement,
                                      Long defaultElement)
      • getLongNoKeyParsing

        public Long getLongNoKeyParsing(String jsonPath)
      • getLongNoKeyParsing

        public Long getLongNoKeyParsing(String jsonPath,
                                        Long defaultElement)
      • getLong

        protected Long getLong(String jsonPath,
                               boolean hasdefaultElement,
                               Long defaultElement,
                               boolean parseJsonPath)
      • getLongFromObject

        protected Long getLongFromObject(Object object)
      • getFloat

        public Float getFloat(String jsonPath,
                              Float defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets an element as Float using the specified JsonPath.
        Specified by:
        getFloat in interface JsonObjectOrArray
        Returns:
        the element or the specified defaultElement if not found.
      • getFloatElement

        protected Float getFloatElement(String jsonPath,
                                        boolean hasdefaultElement,
                                        Float defaultElement)
      • getFloatNoKeyParsing

        public Float getFloatNoKeyParsing(String jsonPath)
      • getFloatNoKeyParsing

        public Float getFloatNoKeyParsing(String jsonPath,
                                          Float defaultElement)
      • getFloat

        protected Float getFloat(String jsonPath,
                                 boolean hasdefaultElement,
                                 Float defaultElement,
                                 boolean parseJsonPath)
      • getFloatFromObject

        protected Float getFloatFromObject(Object object)
      • getDouble

        public Double getDouble(String jsonPath,
                                Double defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets an element as Double using the specified JsonPath.
        Specified by:
        getDouble in interface JsonObjectOrArray
        Returns:
        the element or the specified defaultElement if not found.
      • getDoubleElement

        protected Double getDoubleElement(String jsonPath,
                                          boolean hasdefaultElement,
                                          Double defaultElement)
      • getDoubleNoKeyParsing

        public Double getDoubleNoKeyParsing(String jsonPath)
      • getDoubleNoKeyParsing

        public Double getDoubleNoKeyParsing(String jsonPath,
                                            Double defaultElement)
      • getDouble

        protected Double getDouble(String jsonPath,
                                   boolean hasdefaultElement,
                                   Double defaultElement,
                                   boolean parseJsonPath)
      • getDoubleFromObject

        protected Double getDoubleFromObject(Object object)
      • getBooleanElement

        protected Boolean getBooleanElement(String jsonPath,
                                            boolean hasdefaultElement,
                                            Boolean defaultElement)
      • getBooleanNoKeyParsing

        public Boolean getBooleanNoKeyParsing(String jsonPath)
      • getBooleanNoKeyParsing

        public Boolean getBooleanNoKeyParsing(String jsonPath,
                                              Boolean defaultElement)
      • getBoolean

        protected Boolean getBoolean(String jsonPath,
                                     boolean hasdefaultElement,
                                     Boolean defaultElement,
                                     boolean parseJsonPath)
      • getBooleanFromObject

        protected Boolean getBooleanFromObject(Object object)
      • getBigDecimalElement

        protected BigDecimal getBigDecimalElement(String jsonPath,
                                                  boolean hasdefaultElement,
                                                  BigDecimal defaultElement)
      • getBigDecimalNoKeyParsing

        public BigDecimal getBigDecimalNoKeyParsing(String jsonPath)
      • getBigDecimal

        protected BigDecimal getBigDecimal(String jsonPath,
                                           boolean hasdefaultElement,
                                           BigDecimal defaultElement,
                                           boolean parseJsonPath)
      • getBigDecimalFromObject

        protected BigDecimal getBigDecimalFromObject(Object object)
      • getBytesFromBase64String

        public byte[] getBytesFromBase64String(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Gets a byte array, from a base 64 encoded element using the specified JsonPath.
        Specified by:
        getBytesFromBase64String in interface JsonObjectOrArray
        Returns:
        the element or null if not found.
      • getBytesFromBase64String

        public byte[] getBytesFromBase64String(String jsonPath,
                                               byte[] defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets a byte array, from a base 64 encoded element using the specified JsonPath.
        Specified by:
        getBytesFromBase64String in interface JsonObjectOrArray
        Returns:
        the element or the specified defaultElement if not found.
      • getBytesFromBase64StringElement

        protected byte[] getBytesFromBase64StringElement(String jsonPath,
                                                         boolean hasdefaultElement,
                                                         byte[] defaultElement)
      • getBytesFromBase64StringNoKeyParsing

        public byte[] getBytesFromBase64StringNoKeyParsing(String jsonPath)
      • getBytesFromBase64StringNoKeyParsing

        public byte[] getBytesFromBase64StringNoKeyParsing(String jsonPath,
                                                           byte[] defaultElement)
      • getBytesFromBase64String

        protected byte[] getBytesFromBase64String(String jsonPath,
                                                  boolean hasdefaultElement,
                                                  byte[] defaultElement,
                                                  boolean parseJsonPath)
      • getBytesFromBase64StringValueFromObject

        protected byte[] getBytesFromBase64StringValueFromObject(Object object)
      • getDate

        public Date getDate(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Gets a UTC timezoned date from a ISO 8601 date string element using the specified JsonPath.
        Specified by:
        getDate in interface JsonObjectOrArray
        Returns:
        the element or null if not found.
      • getDate

        public Date getDate(String jsonPath,
                            Date defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets a UTC timezoned date from a ISO 8601 date string element using the specified JsonPath.
        Specified by:
        getDate in interface JsonObjectOrArray
        Returns:
        the element or the specified defaultElement if not found.
      • getDateElement

        protected Date getDateElement(String jsonPath,
                                      boolean hasdefaultElement,
                                      Date defaultElement)
      • getDateFromObject

        protected Date getDateFromObject(Object object)
      • getDateNoKeyParsing

        public Date getDateNoKeyParsing(String jsonPath)
      • getDateNoKeyParsing

        public Date getDateNoKeyParsing(String jsonPath,
                                        Date defaultElement)
      • getDate

        protected Date getDate(String jsonPath,
                               boolean hasdefaultElement,
                               Date defaultElement,
                               boolean parseJsonPath)
      • getInstantElement

        protected Instant getInstantElement(String jsonPath,
                                            boolean hasdefaultElement,
                                            Instant defaultElement)
      • getInstantFromObject

        protected Instant getInstantFromObject(Object object)
      • getInstantNoKeyParsing

        public Instant getInstantNoKeyParsing(String jsonPath)
      • getInstantNoKeyParsing

        public Instant getInstantNoKeyParsing(String jsonPath,
                                              Instant defaultElement)
      • getInstant

        protected Instant getInstant(String jsonPath,
                                     boolean hasdefaultElement,
                                     Instant defaultElement,
                                     boolean parseJsonPath)
      • getArrayFirstString

        public String getArrayFirstString(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as String) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstString in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstString

        public String getArrayFirstString(String key,
                                          String defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as String) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstString in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstStringNoKeyParsing

        public String getArrayFirstStringNoKeyParsing(String key)
      • getArrayFirstStringNoKeyParsing

        public String getArrayFirstStringNoKeyParsing(String key,
                                                      String defaultElement)
      • getArrayFirstString

        protected String getArrayFirstString(String key,
                                             boolean parseJsonPath,
                                             boolean hasdefaultElement,
                                             String defaultElement)
      • toJsonString

        public String toJsonString(boolean pretty)
        Description copied from interface: JsonObjectOrArray
        The Json string representation of the object.
        Specified by:
        toJsonString in interface JsonObjectOrArray
        Parameters:
        pretty - if true, the generated String will be formatted.
      • getArrayFirstJsonObject

        public JsonObject getArrayFirstJsonObject(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as JsonObject) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstJsonObject in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstJsonObject

        public JsonObject getArrayFirstJsonObject(String key,
                                                  JsonObject defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as JsonObject) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstJsonObject in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstJsonObjectNoKeyParsing

        public JsonObject getArrayFirstJsonObjectNoKeyParsing(String key)
      • getArrayFirstJsonObjectNoKeyParsing

        public JsonObject getArrayFirstJsonObjectNoKeyParsing(String key,
                                                              JsonObject defaultElement)
      • getArrayFirstJsonObject

        protected JsonObject getArrayFirstJsonObject(String key,
                                                     boolean parseJsonPath,
                                                     boolean hasdefaultElement,
                                                     JsonObject defaultElement)
      • getArrayFirstJsonArray

        public JsonArray getArrayFirstJsonArray(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as JsonArray) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstJsonArray in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstJsonArray

        public JsonArray getArrayFirstJsonArray(String key,
                                                JsonArray defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as JsonArray) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstJsonArray in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstJsonArrayNoKeyParsing

        public JsonArray getArrayFirstJsonArrayNoKeyParsing(String key)
      • getArrayFirstJsonArrayNoKeyParsing

        public JsonArray getArrayFirstJsonArrayNoKeyParsing(String key,
                                                            JsonArray defaultElement)
      • getArrayFirstJsonArray

        protected JsonArray getArrayFirstJsonArray(String key,
                                                   boolean parseJsonPath,
                                                   boolean hasdefaultElement,
                                                   JsonArray defaultElement)
      • getArrayFirstInteger

        public Integer getArrayFirstInteger(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Integer) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstInteger in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstInteger

        public Integer getArrayFirstInteger(String key,
                                            Integer defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Integer) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstInteger in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstIntegerNoKeyParsing

        public Integer getArrayFirstIntegerNoKeyParsing(String key)
      • getArrayFirstIntegerNoKeyParsing

        public Integer getArrayFirstIntegerNoKeyParsing(String key,
                                                        Integer defaultElement)
      • getArrayFirstInteger

        protected Integer getArrayFirstInteger(String key,
                                               boolean parseJsonPath,
                                               boolean hasdefaultElement,
                                               Integer defaultElement)
      • getArrayFirstLong

        public Long getArrayFirstLong(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Long) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstLong in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstLong

        public Long getArrayFirstLong(String key,
                                      Long defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Long) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstLong in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstLongNoKeyParsing

        public Long getArrayFirstLongNoKeyParsing(String key)
      • getArrayFirstLongNoKeyParsing

        public Long getArrayFirstLongNoKeyParsing(String key,
                                                  Long defaultElement)
      • getArrayFirstLong

        protected Long getArrayFirstLong(String key,
                                         boolean parseJsonPath,
                                         boolean hasdefaultElement,
                                         Long defaultElement)
      • getArrayFirstDouble

        public Double getArrayFirstDouble(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Double) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstDouble in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstDouble

        public Double getArrayFirstDouble(String key,
                                          Double defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Double) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstDouble in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstDoubleNoKeyParsing

        public Double getArrayFirstDoubleNoKeyParsing(String key)
      • getArrayFirstDoubleNoKeyParsing

        public Double getArrayFirstDoubleNoKeyParsing(String key,
                                                      Double defaultElement)
      • getArrayFirstDouble

        protected Double getArrayFirstDouble(String key,
                                             boolean parseJsonPath,
                                             boolean hasdefaultElement,
                                             Double defaultElement)
      • getArrayFirstFloat

        public Float getArrayFirstFloat(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Float) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstFloat in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstFloat

        public Float getArrayFirstFloat(String key,
                                        Float defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Float) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstFloat in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstFloatNoKeyParsing

        public Float getArrayFirstFloatNoKeyParsing(String key)
      • getArrayFirstFloatNoKeyParsing

        public Float getArrayFirstFloatNoKeyParsing(String key,
                                                    Float defaultElement)
      • getArrayFirstFloat

        protected Float getArrayFirstFloat(String key,
                                           boolean parseJsonPath,
                                           boolean hasdefaultElement,
                                           Float defaultElement)
      • getArrayFirstBoolean

        public Boolean getArrayFirstBoolean(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Boolean) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstBoolean in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstBoolean

        public Boolean getArrayFirstBoolean(String key,
                                            Boolean defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Boolean) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstBoolean in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstBooleanNoKeyParsing

        public Boolean getArrayFirstBooleanNoKeyParsing(String key)
      • getArrayFirstBooleanNoKeyParsing

        public Boolean getArrayFirstBooleanNoKeyParsing(String key,
                                                        Boolean defaultElement)
      • getArrayFirstBoolean

        protected Boolean getArrayFirstBoolean(String key,
                                               boolean parseJsonPath,
                                               boolean hasdefaultElement,
                                               Boolean defaultElement)
      • getArrayFirstBigDecimal

        public BigDecimal getArrayFirstBigDecimal(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as BigDecimal) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstBigDecimal in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstBigDecimal

        public BigDecimal getArrayFirstBigDecimal(String key,
                                                  BigDecimal defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as BigDecimal) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstBigDecimal in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstBigDecimalNoKeyParsing

        public BigDecimal getArrayFirstBigDecimalNoKeyParsing(String key)
      • getArrayFirstBigDecimalNoKeyParsing

        public BigDecimal getArrayFirstBigDecimalNoKeyParsing(String key,
                                                              BigDecimal defaultElement)
      • getArrayFirstBigDecimal

        protected BigDecimal getArrayFirstBigDecimal(String key,
                                                     boolean parseJsonPath,
                                                     boolean hasdefaultElement,
                                                     BigDecimal defaultElement)
      • getArrayFirstBytesFromBase64String

        public byte[] getArrayFirstBytesFromBase64String(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as byte[]) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstBytesFromBase64String in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstBytesFromBase64String

        public byte[] getArrayFirstBytesFromBase64String(String key,
                                                         byte[] defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as byte[]) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstBytesFromBase64String in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstBytesFromBase64StringNoKeyParsing

        public byte[] getArrayFirstBytesFromBase64StringNoKeyParsing(String key)
      • getArrayFirstBytesFromBase64StringNoKeyParsing

        public byte[] getArrayFirstBytesFromBase64StringNoKeyParsing(String key,
                                                                     byte[] defaultElement)
      • getArrayFirstBytesFromBase64String

        protected byte[] getArrayFirstBytesFromBase64String(String key,
                                                            boolean parseJsonPath,
                                                            boolean hasdefaultElement,
                                                            byte[] defaultElement)
      • getArrayFirstDate

        public Date getArrayFirstDate(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Date) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstDate in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstDate

        public Date getArrayFirstDate(String key,
                                      Date defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Date) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstDate in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstDateNoKeyParsing

        public Date getArrayFirstDateNoKeyParsing(String key)
      • getArrayFirstDateNoKeyParsing

        public Date getArrayFirstDateNoKeyParsing(String key,
                                                  Date defaultElement)
      • getArrayFirstDate

        protected Date getArrayFirstDate(String jsonPath,
                                         boolean parseJsonPath,
                                         boolean hasdefaultElement,
                                         Date defaultElement)
      • getArrayFirstInstant

        public Instant getArrayFirstInstant(String key)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Instant) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstInstant in interface JsonObjectOrArray
        Returns:
        the value of the property or null if the array or the first element are not found.
      • getArrayFirstInstant

        public Instant getArrayFirstInstant(String key,
                                            Instant defaultElement)
        Description copied from interface: JsonObjectOrArray
        Gets the first value (as Instant) of a JsonArray property of the object, using the JsonPath to find the array.
        Specified by:
        getArrayFirstInstant in interface JsonObjectOrArray
        Returns:
        the value of the property or the specified defaultElement if the array or the first element are not found.
      • getArrayFirstInstantNoKeyParsing

        public Instant getArrayFirstInstantNoKeyParsing(String key)
      • getArrayFirstInstantNoKeyParsing

        public Instant getArrayFirstInstantNoKeyParsing(String key,
                                                        Instant defaultElement)
      • getArrayFirstInstant

        protected Instant getArrayFirstInstant(String jsonPath,
                                               boolean parseJsonPath,
                                               boolean hasdefaultElement,
                                               Instant defaultElement)
      • isCanBeConvertedToString

        public boolean isCanBeConvertedToString(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type String, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToString in interface JsonObjectOrArray
      • isCanBeConvertedToStringNoKeyParsing

        public boolean isCanBeConvertedToStringNoKeyParsing(String jsonPath)
      • isCanBeConvertedToString

        protected boolean isCanBeConvertedToString(String jsonPath,
                                                   boolean parseKey)
      • isCanBeConvertedToInteger

        public boolean isCanBeConvertedToInteger(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type Integer, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToInteger in interface JsonObjectOrArray
      • isCanBeConvertedToIntegerNoKeyParsing

        public boolean isCanBeConvertedToIntegerNoKeyParsing(String jsonPath)
      • isCanBeConvertedToInteger

        protected boolean isCanBeConvertedToInteger(String jsonPath,
                                                    boolean parseKey)
      • isCanBeConvertedToLong

        public boolean isCanBeConvertedToLong(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type Long, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToLong in interface JsonObjectOrArray
      • isCanBeConvertedToLongNoKeyParsing

        public boolean isCanBeConvertedToLongNoKeyParsing(String jsonPath)
      • isCanBeConvertedToLong

        protected boolean isCanBeConvertedToLong(String jsonPath,
                                                 boolean parseKey)
      • isCanBeConvertedToFloat

        public boolean isCanBeConvertedToFloat(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type Float, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToFloat in interface JsonObjectOrArray
      • isCanBeConvertedToFloatNoKeyParsing

        public boolean isCanBeConvertedToFloatNoKeyParsing(String jsonPath)
      • isCanBeConvertedToFloat

        protected boolean isCanBeConvertedToFloat(String jsonPath,
                                                  boolean parseKey)
      • isCanBeConvertedToDouble

        public boolean isCanBeConvertedToDouble(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type Double, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToDouble in interface JsonObjectOrArray
      • isCanBeConvertedToDoubleNoKeyParsing

        public boolean isCanBeConvertedToDoubleNoKeyParsing(String jsonPath)
      • isCanBeConvertedToDouble

        protected boolean isCanBeConvertedToDouble(String jsonPath,
                                                   boolean parseKey)
      • isCanBeConvertedToBoolean

        public boolean isCanBeConvertedToBoolean(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type Boolean, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToBoolean in interface JsonObjectOrArray
      • isCanBeConvertedToBooleanNoKeyParsing

        public boolean isCanBeConvertedToBooleanNoKeyParsing(String jsonPath)
      • isCanBeConvertedToBoolean

        protected boolean isCanBeConvertedToBoolean(String jsonPath,
                                                    boolean parseKey)
      • isCanBeConvertedToBigDecimal

        public boolean isCanBeConvertedToBigDecimal(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type BigDecimal, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToBigDecimal in interface JsonObjectOrArray
      • isCanBeConvertedToBigDecimalNoKeyParsing

        public boolean isCanBeConvertedToBigDecimalNoKeyParsing(String jsonPath)
      • isCanBeConvertedToBigDecimal

        protected boolean isCanBeConvertedToBigDecimal(String jsonPath,
                                                       boolean parseKey)
      • isCanBeConvertedToByteArray

        public boolean isCanBeConvertedToByteArray(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type base 64 String representing a byte array, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToByteArray in interface JsonObjectOrArray
      • isCanBeConvertedToByteArrayNoKeyParsing

        public boolean isCanBeConvertedToByteArrayNoKeyParsing(String jsonPath)
      • isCanBeConvertedToByteArray

        protected boolean isCanBeConvertedToByteArray(String jsonPath,
                                                      boolean parseKey)
      • isCanBeConvertedToDate

        public boolean isCanBeConvertedToDate(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type Date, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToDate in interface JsonObjectOrArray
      • isCanBeConvertedToDateNoKeyParsing

        public boolean isCanBeConvertedToDateNoKeyParsing(String jsonPath)
      • isCanBeConvertedToDate

        protected boolean isCanBeConvertedToDate(String jsonPath,
                                                 boolean parseKey)
      • isCanBeConvertedToJsonObject

        public boolean isCanBeConvertedToJsonObject(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type JsonObject, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToJsonObject in interface JsonObjectOrArray
      • isCanBeConvertedToJsonObjectNoKeyParsing

        public boolean isCanBeConvertedToJsonObjectNoKeyParsing(String jsonPath)
      • isCanBeConvertedToJsonObject

        protected boolean isCanBeConvertedToJsonObject(String jsonPath,
                                                       boolean parseKey)
      • isCanBeConvertedToJsonArray

        public boolean isCanBeConvertedToJsonArray(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null, of type JsonArray, or can be converted and retrieved as one.
        Specified by:
        isCanBeConvertedToJsonArray in interface JsonObjectOrArray
      • isCanBeConvertedToJsonArrayNoKeyParsing

        public boolean isCanBeConvertedToJsonArrayNoKeyParsing(String jsonPath)
      • isCanBeConvertedToJsonArray

        protected boolean isCanBeConvertedToJsonArray(String jsonPath,
                                                      boolean parseKey)
      • isOfTypeString

        public boolean isOfTypeString(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type String, without requiring any conversion.
        Specified by:
        isOfTypeString in interface JsonObjectOrArray
      • isOfTypeStringNoKeyParsing

        public boolean isOfTypeStringNoKeyParsing(String jsonPath)
      • isOfTypeString

        public boolean isOfTypeString(String jsonPath,
                                      boolean parseKey)
      • isOfTypeInteger

        public boolean isOfTypeInteger(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type Integer, without requiring any conversion.
        Specified by:
        isOfTypeInteger in interface JsonObjectOrArray
      • isOfTypeIntegerNoKeyParsing

        public boolean isOfTypeIntegerNoKeyParsing(String jsonPath)
      • isOfTypeInteger

        public boolean isOfTypeInteger(String jsonPath,
                                       boolean parseKey)
      • isOfTypeLong

        public boolean isOfTypeLong(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type Long, without requiring any conversion.
        Specified by:
        isOfTypeLong in interface JsonObjectOrArray
      • isOfTypeLongNoKeyParsing

        public boolean isOfTypeLongNoKeyParsing(String jsonPath)
      • isOfTypeLong

        public boolean isOfTypeLong(String jsonPath,
                                    boolean parseKey)
      • isOfTypeFloat

        public boolean isOfTypeFloat(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type Float, without requiring any conversion.
        Specified by:
        isOfTypeFloat in interface JsonObjectOrArray
      • isOfTypeFloatNoKeyParsing

        public boolean isOfTypeFloatNoKeyParsing(String jsonPath)
      • isOfTypeFloat

        public boolean isOfTypeFloat(String jsonPath,
                                     boolean parseKey)
      • isOfTypeDouble

        public boolean isOfTypeDouble(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type Double, without requiring any conversion.
        Specified by:
        isOfTypeDouble in interface JsonObjectOrArray
      • isOfTypeDoubleNoKeyParsing

        public boolean isOfTypeDoubleNoKeyParsing(String jsonPath)
      • isOfTypeDouble

        public boolean isOfTypeDouble(String jsonPath,
                                      boolean parseKey)
      • isOfTypeBoolean

        public boolean isOfTypeBoolean(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type Boolean, without requiring any conversion.
        Specified by:
        isOfTypeBoolean in interface JsonObjectOrArray
      • isOfTypeBooleanNoKeyParsing

        public boolean isOfTypeBooleanNoKeyParsing(String jsonPath)
      • isOfTypeBoolean

        public boolean isOfTypeBoolean(String jsonPath,
                                       boolean parseKey)
      • isOfTypeBigDecimal

        public boolean isOfTypeBigDecimal(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type BigDecimal, without requiring any conversion.
        Specified by:
        isOfTypeBigDecimal in interface JsonObjectOrArray
      • isOfTypeBigDecimalNoKeyParsing

        public boolean isOfTypeBigDecimalNoKeyParsing(String jsonPath)
      • isOfTypeeBigDecimal

        public boolean isOfTypeeBigDecimal(String jsonPath,
                                           boolean parseKey)
      • isOfTypeByteArray

        public boolean isOfTypeByteArray(String jsonPath,
                                         boolean acceptBase64StringToo)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type byte[], without requiring any conversion.
        Specified by:
        isOfTypeByteArray in interface JsonObjectOrArray
        acceptBase64StringToo - if true, then a valid base 64 String will also be accepted.
      • isOfTypeByteArrayNoKeyParsing

        public boolean isOfTypeByteArrayNoKeyParsing(String jsonPath,
                                                     boolean acceptBase64StringToo)
      • isOfTypeByteArray

        public boolean isOfTypeByteArray(String jsonPath,
                                         boolean acceptBase64StringToo,
                                         boolean parseKey)
      • isOfTypeDate

        public boolean isOfTypeDate(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type Date, without requiring any conversion.
        Specified by:
        isOfTypeDate in interface JsonObjectOrArray
      • isOfTypeDateNoKeyParsing

        public boolean isOfTypeDateNoKeyParsing(String jsonPath)
      • isOfTypeDate

        public boolean isOfTypeDate(String jsonPath,
                                    boolean parseKey)
      • isOfTypeJsonObject

        public boolean isOfTypeJsonObject(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type JsonObject, without requiring any conversion.
        Specified by:
        isOfTypeJsonObject in interface JsonObjectOrArray
      • isOfTypeJsonObjectNoKeyParsing

        public boolean isOfTypeJsonObjectNoKeyParsing(String jsonPath)
      • isOfTypeJsonObject

        public boolean isOfTypeJsonObject(String jsonPath,
                                          boolean parseKey)
      • isOfTypeJsonArray

        public boolean isOfTypeJsonArray(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Validates that the value at the specified JsonPath exists and is currently null or of type JsonArray, without requiring any conversion.
        Specified by:
        isOfTypeJsonArray in interface JsonObjectOrArray
      • isOfTypeJsonArrayNoKeyParsing

        public boolean isOfTypeJsonArrayNoKeyParsing(String jsonPath)
      • isOfTypeJsonArray

        public boolean isOfTypeJsonArray(String jsonPath,
                                         boolean parseKey)
      • isNullNoKeyParsing

        public boolean isNullNoKeyParsing(String jsonPath)
      • validateIsNull

        public boolean validateIsNull(String jsonPath,
                                      boolean parseKey)
      • contains

        public boolean contains(String jsonPath)
        Description copied from interface: JsonObjectOrArray
        Does the object contain an element at the JsonPath position (even if null)?
        Specified by:
        contains in interface JsonObjectOrArray
      • getElement

        protected Object getElement(String key,
                                    boolean hasdefaultElement,
                                    Object defaultElement,
                                    boolean parseJsonPath)
        Gets the element at this key/jsonPath/index. If the current object is immutable, the target element may be cached.
      • trimAll

        public void trimAll()
        Description copied from interface: JsonObjectOrArray
        Trims all the elements of the object that are of type String. This transformation is not recursive.
        Specified by:
        trimAll in interface JsonObjectOrArray
      • trimAll

        public void trimAll(boolean recursive)
        Description copied from interface: JsonObjectOrArray
        Trims all the elements of the object that are of type String.
        Specified by:
        trimAll in interface JsonObjectOrArray
        Parameters:
        recursive - if true, then all children elements will also be trimmed, recursively.
      • set

        public JsonObjectOrArray set(String jsonPath,
                                     Object element)
        Description copied from interface: JsonObjectOrArray
        Sets an element at the specified JsonPath. Overwrites any existing element at that JsonPath.

        The required hierarchy will be created, if required, to support the JsonPath.

        If the object to add is not of a JsonObject's native type, the object is converted to a JsonObject or a JsonArray before being added. Once the object is converted and added, a modification to the original object won't affect the added element, and vice-versa.

        If the element to add is a JsonObject or a JsonArray and is immutable then it will be cloned. Doing so, we can make sure that the current object is always fully mutable or fully immutable.

        If the element implements ToJsonObjectConvertible, it will be converted to a JsonObject using the associated conversion method. If it implements ToJsonArrayConvertible, it will be converted to a JsonArray using the associated conversion method.

        Those are the types of object that will be converted to a JsonArray instead of a JsonObject, if no conversion interface is implemented :

        • A Collection
        • An array

        Specified by:
        set in interface JsonObjectOrArray
      • set

        public JsonObjectOrArray set(String jsonPath,
                                     Object element,
                                     boolean clone)
        Description copied from interface: JsonObjectOrArray
        Sets an element at the specified JsonPath. Overwrites any existing element at that JsonPath.

        The required hierarchy will be created, if required, to support the JsonPath.

        If the object to add is not of a JsonObject's native type, the object is converted to a JsonObject or a JsonArray before being added. Once the object is converted and added, a modification to the original object won't affect the added element, and vice-versa.

        If the element to add is a JsonObject or a JsonArray and is immutable then it will be cloned. Doing so, we can make sure that the current object is always fully mutable or fully immutable.

        If the element implements ToJsonObjectConvertible, it will be converted to a JsonObject using the associated conversion method. If it implements ToJsonArrayConvertible, it will be converted to a JsonArray using the associated conversion method.

        Those are the types of object that will be converted to a JsonArray instead of a JsonObject, if no conversion interface is implemented :

        • A Collection
        • An array

        Specified by:
        set in interface JsonObjectOrArray
        clone - if true, and the element to add is a JsonObject or JsonArray, a clone will be made before being added. If that case, any modification to the original element won't affect the added one, and vice-versa. If the element is immutable then it will always be cloned. Doing so, we can make sure the current object is always fully mutable or fully immutable.
      • transformAll

        public abstract void transformAll(ElementTransformer transformer,
                                          boolean recursive)
        Description copied from interface: JsonObjectOrArray
        Transforms all the elements of the object, using the specified transformer.
        Specified by:
        transformAll in interface JsonObjectOrArray
        recursive - if true, then all children elements will also be transformed, recursively.
      • clone

        public abstract JsonObjectOrArray clone(boolean mutable)
        Clone the object.
        Specified by:
        clone in interface JsonObjectOrArray
        Parameters:
        mutable - if true the resulting object and all its children will be mutable, otherwise they will all be immutable.
      • getElementNoKeyParsing

        protected abstract Object getElementNoKeyParsing(String key,
                                                         boolean hasdefaultElement,
                                                         Object defaultElement)
        Gets the element at this key/index, without key parsing.

Copyright © 2019. All rights reserved.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy