java.lang.Object
org.evomaster.client.java.controller.problem.rpc.schema.params.NamedTypedValue<T,V>
Direct Known Subclasses:
BigDecimalParam, BigIntegerParam, ByteBufferParam, CollectionParam, DateParam, EnumParam, MapParam, ObjectParam, PairParam, PrimitiveOrWrapperParam, Protobuf3ByteStringParam, StringParam

public abstract class NamedTypedValue<T extends TypeSchema,V> extends Object
a named instance of the type with its value, eg Param/Field it could be a request param or a response
  • Field Details

    • objectMaper

      protected static final com.fasterxml.jackson.databind.ObjectMapper objectMaper
    • mapperAllowUnkownFields

      protected static final com.fasterxml.jackson.databind.ObjectMapper mapperAllowUnkownFields
    • accessibleSchema

      public final AccessibleSchema accessibleSchema
      a schema for collecting if the param is accessible
  • Constructor Details

  • Method Details

    • isHasDependentCandidates

      public boolean isHasDependentCandidates()
    • setHasDependentCandidates

      public void setHasDependentCandidates(boolean hasDependentCandidates)
    • getCandidates

      public List<NamedTypedValue> getCandidates()
    • setCandidates

      public void setCandidates(List<NamedTypedValue> candidates)
    • getCandidateReferences

      public List<String> getCandidateReferences()
    • setCandidateReferences

      public void setCandidateReferences(List<String> candidateReferences)
    • getName

      public String getName()
    • getType

      public T getType()
    • getValue

      public V getValue()
    • newInstance

      public abstract Object newInstance() throws ClassNotFoundException
      Throws:
      ClassNotFoundException
    • referenceTypes

      public abstract List<String> referenceTypes()
    • setValue

      public void setValue(V value)
    • setNullable

      public void setNullable(boolean nullable)
    • isNullable

      public boolean isNullable()
    • getDto

      public org.evomaster.client.java.controller.api.dto.problem.rpc.ParamDto getDto()
      get its dto format in order to further handle it with evomastr core
      Returns:
      its corresponding dto
    • copyStructureWithProperties

      public NamedTypedValue<T,V> copyStructureWithProperties()
    • copyStructure

      public abstract NamedTypedValue<T,V> copyStructure()
    • copyProperties

      public void copyProperties(NamedTypedValue copy)
    • sameParam

      public boolean sameParam(org.evomaster.client.java.controller.api.dto.problem.rpc.ParamDto dto)
      it is used to find a param schema based on info specified with dto format
      Parameters:
      dto - specifies a param to check
      Returns:
      whether [this] param schema info is consistent with the given dto
    • setValueBasedOnDto

      public abstract void setValueBasedOnDto(org.evomaster.client.java.controller.api.dto.problem.rpc.ParamDto dto)
      set value based on dto the value is basically obtained from evomaster core
      Parameters:
      dto - contains value info with string
    • setValueBasedOnInstance

      public void setValueBasedOnInstance(Object instance)
      set value of param schema based on its instance it is mainly used to parse response
      Parameters:
      instance - a java object which is an instance of this param schema
    • setValueBasedOnInstanceOrJson

      public void setValueBasedOnInstanceOrJson(Object json) throws com.fasterxml.jackson.core.JsonProcessingException
      set value based on json
      Parameters:
      json - contains value info with json format
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • parseValueWithJson

      public Object parseValueWithJson(String json) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • setValueBasedOnValidInstance

      protected abstract void setValueBasedOnValidInstance(Object instance)
      set the value of the param based on instance compared with [setValueBasedOnInstance], the type of the instance here is evaluated as valid
      Parameters:
      instance - is the instance
    • isValidInstance

      public boolean isValidInstance(Object instance)
      Parameters:
      instance - a java object which is an instance of this param schema
      Returns:
      if the specified instance conforms with this param schema
    • newInstanceWithJavaOrKotlin

      public abstract List<String> newInstanceWithJavaOrKotlin(boolean isDeclaration, boolean doesIncludeName, String variableName, int indent, boolean isJava, boolean isVariableNullable)
      create instances with Java
      Parameters:
      isDeclaration - specifies whether it is used to declare the instance (ie, with type name).
      doesIncludeName - specifies whether it is required to have the variable name eg, if true, var = new instance(); if yes, new instance();
      variableName - specifies the name of variable
      indent - specifies the indent of this block of the code
      isJava -
      isVariableNullable -
      Returns:
      a list of string which could create instance with java
    • newInstanceWithJavaOrKotlin

      public List<String> newInstanceWithJavaOrKotlin(int indent, boolean isJava, boolean isVariableNullable)
      create instances with Java
      Parameters:
      indent - specifies the current indent of the code
      isJava -
      isVariableNullable -
      Returns:
      a list of string which could create instance with java
    • newAssertionWithJavaOrKotlin

      public abstract List<String> newAssertionWithJavaOrKotlin(int indent, String responseVarName, int maxAssertionForDataInCollection, boolean isJava)
      create assertions with java for response
      Parameters:
      indent - specifies the current indent of the code
      responseVarName - a variable name for responses
      maxAssertionForDataInCollection -
      isJava -
      Returns:
      a list of string for assertions
    • newAssertionWithJavaOrKotlin

      public List<String> newAssertionWithJavaOrKotlin(String responseVarName, int maxAssertionForDataInCollection, boolean isJava)
      Parameters:
      responseVarName - is the variable name of the response
      isJava -
      Returns:
      a list of assertions based on this which could be a response
    • getValueAsJavaString

      public abstract String getValueAsJavaString(boolean isJava)
      Returns:
      a string which could representing the value of the param with java eg, float 4.2 could be 4.2f
    • isMutable

      public boolean isMutable()
    • setMutable

      public void setMutable(boolean mutable)
    • getDefaultValue

      public NamedTypedValue getDefaultValue()
    • setDefaultValue

      public void setDefaultValue(NamedTypedValue defaultValue)