public class BinderExtension extends Object implements javax.enterprise.inject.spi.Extension, Binder, RegisterableBinder
Constructor and Description |
---|
BinderExtension()
Create a new instance of BinderExtension
|
Modifier and Type | Method and Description |
---|---|
<T> T |
convertFromString(Class<T> output,
String object)
Convert a String to the given target class
|
<T> T |
convertFromString(Class<T> output,
String object,
Class<? extends Annotation> qualifier)
Convert a String to the given target class
|
<S,T> T |
convertTo(Class<S> sourceClass,
Class<T> target,
Object object)
Convert an object which is an instance of source class to the given target class
|
<S,T> T |
convertTo(Class<S> sourceClass,
Class<T> target,
Object object,
Class<? extends Annotation> qualifier)
Convert an object which is an instance of source class to the given target class
|
<S,T> T |
convertTo(Class<T> output,
Object object)
Convert an object to the given target class
This method infers the source type for the conversion from the runtime type of object.
|
<S,T> T |
convertTo(Class<T> output,
Object object,
Class<? extends Annotation> qualifier)
Convert an object to the given target class
This method infers the source type for the conversion from the runtime type of object.
|
<S,T> T |
convertTo(ConverterKey<S,T> key,
Object object)
Convert an object which is an instance of source class to the given target class
|
<S> String |
convertToString(Class<S> input,
Object object)
Convert an object which is an instance of source class to String
|
<S> String |
convertToString(Class<S> input,
Object object,
Class<? extends Annotation> qualifier)
Convert an object which is an instance of source class to String
|
String |
convertToString(Object object)
Convert an object to String
This method infers the source type for the conversion from the runtime type of object.
|
String |
convertToString(Object object,
Class<? extends Annotation> qualifier)
Convert an object to String
This method infers the source type for the conversion from the runtime type of object.
|
<S,T> Binding<S,T> |
findBinding(Class<S> source,
Class<T> target)
Resolve a Binding with the given source and target class.
|
<S,T> Binding<S,T> |
findBinding(Class<S> source,
Class<T> target,
Class<? extends Annotation> qualifier)
Resolve a Binding with the given source and target class.
|
<S,T> Binding<S,T> |
findBinding(ConverterKey<S,T> key)
Resolve a Binding with the given source and target class.
|
<S,T> Converter<S,T> |
findConverter(Class<S> source,
Class<T> target)
Resolve a Converter with the given input and output classes.
|
<S,T> Converter<S,T> |
findConverter(Class<S> source,
Class<T> target,
Class<? extends Annotation> qualifier)
Resolve a Converter with the given input and output classes.
|
<S,T> Converter<S,T> |
findConverter(ConverterKey<S,T> key)
Resolve a Converter with the given input and output classes.
|
<S,T> ToMarshaller<S,T> |
findMarshaller(Class<S> source,
Class<T> target)
Resolve a Marshaller with the given source and target class.
|
<S,T> ToMarshaller<S,T> |
findMarshaller(Class<S> source,
Class<T> target,
Class<? extends Annotation> qualifier)
Resolve a Marshaller with the given source and target class.
|
<S,T> ToMarshaller<S,T> |
findMarshaller(ConverterKey<S,T> key)
Resolve a Marshaller with the given source and target class.
|
<S,T> FromUnmarshaller<S,T> |
findUnmarshaller(Class<S> source,
Class<T> target)
Resolve an UnMarshaller with the given source and target class.
|
<S,T> FromUnmarshaller<S,T> |
findUnmarshaller(Class<S> source,
Class<T> target,
Class<? extends Annotation> qualifier)
Resolve an UnMarshaller with the given source and target class.
|
<S,T> FromUnmarshaller<S,T> |
findUnmarshaller(ConverterKey<S,T> key)
Resolve an UnMarshaller with the given source and target class.
|
Iterable<ConverterKey<?,?>> |
getConverterEntries()
Return an iterable collection of ConverterKeys, one for each currently registered conversion
|
<T,E> void |
processAnnotatedType(javax.enterprise.inject.spi.ProcessAnnotatedType<T> pat) |
void |
registerAnnotatedClasses(Class<?>... classesToInspect)
Inspect each of the supplied classes, processing any of the annotated methods found
|
<S,T> void |
registerBinding(Class<S> sourceClass,
Class<T> targetClass,
Binding<S,T> converter)
Register a Binding with the given source and target class.
|
<S,T> void |
registerBinding(Class<S> sourceClass,
Class<T> targetClass,
Binding<S,T> converter,
Class<? extends Annotation> qualifier)
Register a Binding with the given source and target class.
|
<S,T> void |
registerBinding(ConverterKey<S,T> key,
Binding<S,T> converter)
Register a Binding with the given source and target class.
|
void |
registerConfiguration(URL nextLocation)
Register the configuration file (bindings.xml) at the given URL
|
<S,T> void |
registerConverter(Class<S> sourceClass,
Class<T> targetClass,
Converter<S,T> converter)
Register a Converter with the given input and output classes.
|
<S,T> void |
registerConverter(Class<S> sourceClass,
Class<T> targetClass,
Converter<S,T> converter,
Class<? extends Annotation> qualifier)
Register a Converter with the given input and output classes.
|
<S,T> void |
registerConverter(ConverterKey<S,T> key,
Converter<S,T> converter)
Register a Converter with the given input and output classes.
|
<S,T> void |
registerMarshaller(Class<S> sourceClass,
Class<T> targetClass,
ToMarshaller<S,T> converter)
Register a Marshaller with the given source and target class.
|
<S,T> void |
registerMarshaller(Class<S> sourceClass,
Class<T> targetClass,
ToMarshaller<S,T> converter,
Class<? extends Annotation> qualifier)
Register a Marshaller with the given source and target class.
|
<S,T> void |
registerMarshaller(ConverterKey<S,T> key,
ToMarshaller<S,T> converter)
Register a Marshaller with the given source and target class.
|
<S,T> void |
registerUnmarshaller(Class<S> sourceClass,
Class<T> targetClass,
FromUnmarshaller<S,T> converter)
Register an UnMarshaller with the given source and target class.
|
<S,T> void |
registerUnmarshaller(Class<S> sourceClass,
Class<T> targetClass,
FromUnmarshaller<S,T> converter,
Class<? extends Annotation> qualifier)
Register an UnMarshaller with the given source and target class.
|
<S,T> void |
registerUnmarshaller(ConverterKey<S,T> key,
FromUnmarshaller<S,T> converter)
Register an UnMarshaller with the given source and target class.
|
public BinderExtension()
public <T,E> void processAnnotatedType(@Observes javax.enterprise.inject.spi.ProcessAnnotatedType<T> pat)
public <S,T> T convertTo(Class<T> output, Object object)
convertTo
in interface ConversionBinder
S
- The Source typeT
- The Target typeoutput
- The target class to convert the object toobject
- The object to be convertedpublic <S,T> T convertTo(Class<T> output, Object object, Class<? extends Annotation> qualifier)
convertTo
in interface ConversionBinder
S
- The Source typeT
- The Target typeoutput
- The target class to convert the object toobject
- The object to be convertedqualifier
- The qualifier for which the binding must be registeredpublic <S,T> T convertTo(Class<S> sourceClass, Class<T> target, Object object)
convertTo
in interface ConversionBinder
S
- The Source typeT
- The Target typesourceClass
- The class of the object to be convertedtarget
- The target class to convert the object toobject
- The object to be convertedpublic <S,T> T convertTo(Class<S> sourceClass, Class<T> target, Object object, Class<? extends Annotation> qualifier)
convertTo
in interface ConversionBinder
S
- The Source typeT
- The Target typesourceClass
- The class of the object to be convertedtarget
- The target class to convert the object toobject
- The object to be convertedqualifier
- Match the converter with the given qualifierpublic <S,T> T convertTo(ConverterKey<S,T> key, Object object)
convertTo
in interface ConversionBinder
S
- The Source typeT
- The Target typekey
- The converter keyobject
- The object to be convertedpublic <S,T> Binding<S,T> findBinding(Class<S> source, Class<T> target)
findBinding
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The source (owning) classtarget
- The target (foreign) classpublic <S,T> ToMarshaller<S,T> findMarshaller(Class<S> source, Class<T> target)
findMarshaller
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The source (input) classtarget
- The target (output) classpublic <S,T> Converter<S,T> findConverter(Class<S> source, Class<T> target)
findConverter
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The input classtarget
- The output classpublic <S,T> FromUnmarshaller<S,T> findUnmarshaller(Class<S> source, Class<T> target)
findUnmarshaller
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The source (input) classtarget
- The target (output) classpublic <S,T> Binding<S,T> findBinding(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier)
findBinding
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The source (owning) classtarget
- The target (foreign) classqualifier
- The qualifier for which the binding must be registeredpublic <S,T> Binding<S,T> findBinding(ConverterKey<S,T> key)
findBinding
in interface SearchableBinder
S
- The Source typeT
- The Target typekey
- The converter keypublic <S,T> ToMarshaller<S,T> findMarshaller(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier)
findMarshaller
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The source (input) classtarget
- The target (output) classqualifier
- The qualifier for which the marshaller must be registeredpublic <S,T> ToMarshaller<S,T> findMarshaller(ConverterKey<S,T> key)
findMarshaller
in interface SearchableBinder
S
- The Source typeT
- The Target typekey
- The converter keypublic <S,T> Converter<S,T> findConverter(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier)
findConverter
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The input classtarget
- The output classqualifier
- The qualifier for which the marshaller must be registeredpublic <S,T> Converter<S,T> findConverter(ConverterKey<S,T> key)
findConverter
in interface SearchableBinder
S
- The Source typeT
- The Target typekey
- The converter keypublic <S,T> FromUnmarshaller<S,T> findUnmarshaller(Class<S> source, Class<T> target, Class<? extends Annotation> qualifier)
findUnmarshaller
in interface SearchableBinder
S
- The Source typeT
- The Target typesource
- The source (input) classtarget
- The target (output) classqualifier
- The qualifier for which the unmarshaller must be registeredpublic <S,T> FromUnmarshaller<S,T> findUnmarshaller(ConverterKey<S,T> key)
findUnmarshaller
in interface SearchableBinder
S
- The Source typeT
- The Target typekey
- The converter keypublic void registerConfiguration(URL nextLocation)
registerConfiguration
in interface RegisterableBinder
nextLocation
- The URL to registerpublic <S,T> void registerBinding(Class<S> sourceClass, Class<T> targetClass, Binding<S,T> converter)
registerBinding
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (owning) classtargetClass
- The target (foreign) classconverter
- The binding to be registeredpublic <S,T> void registerUnmarshaller(Class<S> sourceClass, Class<T> targetClass, FromUnmarshaller<S,T> converter)
registerUnmarshaller
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (input) classtargetClass
- The target (output) classconverter
- The FromUnmarshaller to be registeredpublic <S,T> void registerMarshaller(Class<S> sourceClass, Class<T> targetClass, ToMarshaller<S,T> converter)
registerMarshaller
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (input) classtargetClass
- The target (output) classconverter
- The ToMarshaller to be registeredpublic <S,T> void registerConverter(Class<S> sourceClass, Class<T> targetClass, Converter<S,T> converter)
registerConverter
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (input) classtargetClass
- The target (output) classconverter
- The Converter to be registeredpublic <S,T> void registerBinding(Class<S> sourceClass, Class<T> targetClass, Binding<S,T> converter, Class<? extends Annotation> qualifier)
registerBinding
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (owning) classtargetClass
- The target (foreign) classconverter
- The binding to be registeredqualifier
- The qualifier for which the binding must be registeredpublic <S,T> void registerBinding(ConverterKey<S,T> key, Binding<S,T> converter)
registerBinding
in interface RegisterableBinder
S
- Source typeT
- Target typekey
- The converter keyconverter
- The binding to be registeredpublic <S,T> void registerUnmarshaller(Class<S> sourceClass, Class<T> targetClass, FromUnmarshaller<S,T> converter, Class<? extends Annotation> qualifier)
registerUnmarshaller
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (input) classtargetClass
- The target (output) classconverter
- The FromUnmarshaller to be registeredqualifier
- The qualifier for which the unmarshaller must be registeredpublic <S,T> void registerUnmarshaller(ConverterKey<S,T> key, FromUnmarshaller<S,T> converter)
registerUnmarshaller
in interface RegisterableBinder
S
- Source typeT
- Target typekey
- The converter keyconverter
- The FromUnmarshaller to be registeredpublic <S,T> void registerMarshaller(Class<S> sourceClass, Class<T> targetClass, ToMarshaller<S,T> converter, Class<? extends Annotation> qualifier)
registerMarshaller
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (input) classtargetClass
- The target (output) classconverter
- The ToMarshaller to be registeredqualifier
- The qualifier for which the marshaller must be registeredpublic <S,T> void registerMarshaller(ConverterKey<S,T> key, ToMarshaller<S,T> converter)
registerMarshaller
in interface RegisterableBinder
S
- Source typeT
- Target typekey
- The converter keyconverter
- The ToMarshaller to be registeredpublic <S,T> void registerConverter(Class<S> sourceClass, Class<T> targetClass, Converter<S,T> converter, Class<? extends Annotation> qualifier)
registerConverter
in interface RegisterableBinder
S
- Source typeT
- Target typesourceClass
- The source (input) classtargetClass
- The target (output) classconverter
- The Converter to be registeredqualifier
- The qualifier for which the converter must be registeredpublic <S,T> void registerConverter(ConverterKey<S,T> key, Converter<S,T> converter)
registerConverter
in interface RegisterableBinder
S
- Source typeT
- Target typekey
- The converter keyconverter
- The Converter to be registeredpublic void registerAnnotatedClasses(Class<?>... classesToInspect)
registerAnnotatedClasses
in interface RegisterableBinder
public Iterable<ConverterKey<?,?>> getConverterEntries()
getConverterEntries
in interface RegisterableBinder
public <T> T convertFromString(Class<T> output, String object)
convertFromString
in interface StringBinder
T
- The type of the target classoutput
- The target class to convert the object toobject
- The String to be convertedpublic <T> T convertFromString(Class<T> output, String object, Class<? extends Annotation> qualifier)
convertFromString
in interface StringBinder
T
- The type of the target classoutput
- The target class to convert the object toobject
- The String to be convertedqualifier
- The qualifier for which the binding must be registeredpublic String convertToString(Object object)
convertToString
in interface StringBinder
object
- The object to be convertedpublic String convertToString(Object object, Class<? extends Annotation> qualifier)
convertToString
in interface StringBinder
object
- The object to be convertedqualifier
- The qualifier for which the binding must be registeredpublic <S> String convertToString(Class<S> input, Object object)
convertToString
in interface StringBinder
S
- The type of the input classinput
- The class of the object to be convertedobject
- The object to be convertedpublic <S> String convertToString(Class<S> input, Object object, Class<? extends Annotation> qualifier)
convertToString
in interface StringBinder
S
- The type of the input classinput
- The class of the object to be convertedobject
- The object to be convertedqualifier
- Match the converter with the given qualifierCopyright © 2010–2018 Jadira Systems. All rights reserved.