- Type Parameters:
BASIC- The basic type
- All Known Subinterfaces:
NumberWrapper<BASIC>
- All Known Implementing Classes:
AbstractWrapper,ArrayWrapper,BigDecimalWrapper,BigIntegerWrapper,BlobWrapper,BooleanWrapper,BytesWrapper,ByteWrapper,ClobWrapper,DateWrapper,DoubleWrapper,EnumWrapper,FloatWrapper,IntegerWrapper,LocalDateTimeWrapper,LocalDateWrapper,LocalTimeWrapper,LongWrapper,NClobWrapper,ObjectWrapper,PrimitiveBooleanWrapper,PrimitiveByteWrapper,PrimitiveDoubleWrapper,PrimitiveFloatWrapper,PrimitiveIntWrapper,PrimitiveLongWrapper,PrimitiveShortWrapper,ShortWrapper,SQLXMLWrapper,StringWrapper,TimestampWrapper,TimeWrapper,UtilDateWrapper
public interface Wrapper<BASIC>
A wrapper for a basic type.
The implementation instance is not required to be thread safe.
-
Method Summary
Modifier and TypeMethodDescription<R,P, Q, TH extends Throwable>
Raccept(WrapperVisitor<R, P, Q, TH> visitor, P p, Q q) Accept a visitor.get()Returns the value.Returns the class of the basic type.getCopy()Return a copy of the value.Returns the default value.booleanhasEqualValue(Object other) Whether this object has an equal value to the other one.default booleanWhether this object is a wrapper for a primitive type.voidSets the value.
-
Method Details
-
get
BASIC get()Returns the value.The value may be
null.- Returns:
- the value.
-
set
Sets the value.- Parameters:
value- the value
-
getCopy
BASIC getCopy()Return a copy of the value.- Returns:
- a copy of the value
-
getDefault
BASIC getDefault()Returns the default value.- Returns:
- the boxed default value of a primitive type if this is a wrapper for a boxed type, else
null
-
hasEqualValue
Whether this object has an equal value to the other one.- Parameters:
other- the other object- Returns:
trueif this object has an equal value to the other one.
-
getBasicClass
Returns the class of the basic type.- Returns:
- the class of the basic type
-
isPrimitiveWrapper
default boolean isPrimitiveWrapper()Whether this object is a wrapper for a primitive type.- Returns:
trueif this object is a wrapper for a primitive type.
-
accept
Accept a visitor.- Type Parameters:
R- The resultP- The first parameter typeQ- The second parameter typeTH- The error or exception type- Parameters:
visitor- the visitorp- the first parameterq- the second parameter- Returns:
- the result
- Throws:
TH- the error or exception typeDomaNullPointerException- ifvisitorisnull
-