Package org.joda.time.convert
Class ConverterSet
java.lang.Object
org.joda.time.convert.ConverterSet
A set of converters, which allows exact converters to be quickly
selected. This class is threadsafe because it is (essentially) immutable.
- Since:
- 1.0
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) ConverterSetReturns a copy of this set, with the given converter added.(package private) voidCopies all the converters in the set to the given array.(package private) ConverterSetReturns a copy of this set, with the converter at the given index removed.(package private) ConverterSetReturns a copy of this set, with the given converter removed.(package private) ConverterReturns the closest matching converter for the given type, or null if none found.private static ConverterselectSlow(ConverterSet set, Class<?> type) Returns the closest matching converter for the given type, but not very efficiently.(package private) intsize()Returns the amount of converters in the set.
-
Field Details
-
iConverters
-
iSelectEntries
-
-
Constructor Details
-
ConverterSet
ConverterSet(Converter[] converters)
-
-
Method Details
-
select
Returns the closest matching converter for the given type, or null if none found.- Parameters:
type- type to select, which may be null- Throws:
IllegalStateException- if multiple converters match the type equally well
-
size
int size()Returns the amount of converters in the set. -
copyInto
Copies all the converters in the set to the given array. -
add
Returns a copy of this set, with the given converter added. If a matching converter is already in the set, the given converter replaces it. If the converter is exactly the same as one already in the set, the original set is returned.- Parameters:
converter- converter to add, must not be nullremoved- if not null, element 0 is set to the removed converter- Throws:
NullPointerException- if converter is null
-
remove
Returns a copy of this set, with the given converter removed. If the converter was not in the set, the original set is returned.- Parameters:
converter- converter to remove, must not be nullremoved- if not null, element 0 is set to the removed converter- Throws:
NullPointerException- if converter is null
-
remove
Returns a copy of this set, with the converter at the given index removed.- Parameters:
index- index of converter to removeremoved- if not null, element 0 is set to the removed converter- Throws:
IndexOutOfBoundsException- if the index is invalid
-
selectSlow
Returns the closest matching converter for the given type, but not very efficiently.
-