Package com.orbitz.consul.model.query
Class ImmutableTemplate
- java.lang.Object
-
- com.orbitz.consul.model.query.Template
-
- com.orbitz.consul.model.query.ImmutableTemplate
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableTemplate.BuilderBuilds instances of typeImmutableTemplate.
-
Method Summary
Modifier and Type Method Description static ImmutableTemplate.Builderbuilder()Creates a builder forImmutableTemplate.static ImmutableTemplatecopyOf(Template instance)Creates an immutable copy of aTemplatevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofImmutableTemplatethat have equal attribute values.java.util.Optional<java.lang.String>getRegExp()java.lang.StringgetType()inthashCode()Computes a hash code from attributes:type,regExp.java.lang.StringtoString()Prints the immutable valueTemplatewith attribute values.ImmutableTemplatewithRegExp(java.lang.String value)Copy the current immutable object by setting a present value for the optionalregExpattribute.ImmutableTemplatewithRegExp(java.util.Optional<java.lang.String> optional)Copy the current immutable object by setting an optional value for theregExpattribute.ImmutableTemplatewithType(java.lang.String value)Copy the current immutable object by setting a value for thetypeattribute.
-
-
-
Method Detail
-
getType
public java.lang.String getType()
-
getRegExp
public java.util.Optional<java.lang.String> getRegExp()
-
withType
public final ImmutableTemplate withType(java.lang.String value)
Copy the current immutable object by setting a value for thetypeattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for type- Returns:
- A modified copy of the
thisobject
-
withRegExp
public final ImmutableTemplate withRegExp(java.lang.String value)
Copy the current immutable object by setting a present value for the optionalregExpattribute.- Parameters:
value- The value for regExp- Returns:
- A modified copy of
thisobject
-
withRegExp
public final ImmutableTemplate withRegExp(java.util.Optional<java.lang.String> optional)
Copy the current immutable object by setting an optional value for theregExpattribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis.- Parameters:
optional- A value for regExp- Returns:
- A modified copy of
thisobject
-
equals
public boolean equals(@Nullable java.lang.Object another)This instance is equal to all instances ofImmutableTemplatethat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:type,regExp.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueTemplatewith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
copyOf
public static ImmutableTemplate copyOf(Template instance)
Creates an immutable copy of aTemplatevalue. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance- The instance to copy- Returns:
- A copied immutable Template instance
-
builder
public static ImmutableTemplate.Builder builder()
Creates a builder forImmutableTemplate.ImmutableTemplate.builder() .type(String) // requiredtype.regExp(String) // optionalregExp.build();- Returns:
- A new ImmutableTemplate builder
-
-