Record Class Property<T>
java.lang.Object
java.lang.Record
org.teleight.teleightbots.conversation.Property<T>
- Type Parameters:
T- the type of the property value.- Record Components:
name- the name of the property. Cannot be null.value- the value of the property.required- whether the property is required or not.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<A> AReturns the value of the property as a custom type.booleanasBool()Returns the value of the property as a boolean.floatasFloat()Returns the value of the property as a double.intasInt()Returns the value of the property as an integer.longasLong()Returns the value of the property as a long.asString()Returns the value of the property as a string.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull Stringname()Returns the value of thenamerecord component.Creates a new property with the given name.static <T> Property<T> Creates a new property with the given name and value.booleanrequired()Returns the value of therequiredrecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Property
-
-
Method Details
-
of
-
of
-
asString
Returns the value of the property as a string.- Returns:
- the value of the property as a string.
-
asInt
public int asInt()Returns the value of the property as an integer.- Returns:
- the value of the property as an integer.
- Throws:
ClassCastException- if the value cannot be cast to an integer.
-
asBool
public boolean asBool()Returns the value of the property as a boolean.- Returns:
- the value of the property as a boolean.
- Throws:
ClassCastException- if the value cannot be cast to a boolean.
-
asLong
public long asLong()Returns the value of the property as a long.- Returns:
- the value of the property as a long.
- Throws:
ClassCastException- if the value cannot be cast to a long.
-
asFloat
public float asFloat()Returns the value of the property as a double.- Returns:
- the value of the property as a double.
- Throws:
ClassCastException- if the value cannot be cast to a double.
-
as
Returns the value of the property as a custom type.- Returns:
- the value of the property as a custom type.
- Throws:
ClassCastException- if the value cannot be cast to a custom type.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
name
-
value
-
required
-