Package com.jidesoft.converter
Class ConverterContext
- java.lang.Object
-
- com.jidesoft.converter.AbstractContext
-
- com.jidesoft.converter.ConverterContext
-
- All Implemented Interfaces:
java.io.Serializable
public class ConverterContext extends AbstractContext
The context object used by ObjectConverter. For the same type, we may need different way to convert them. This context is used so that user can register different converters for the same type.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ConverterContext
DEFAULT_CONTEXT
Default converter context with empty name and no user object.static ConverterContext
DEFAULT_CONTEXT_DYNAMIC_VALUE
Deprecated.
-
Constructor Summary
Constructors Constructor Description ConverterContext(java.lang.String name)
Creates a converter context with a name.ConverterContext(java.lang.String name, java.lang.Object object)
Creates a converter context with a name and an object.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ConverterContext
getArrayConverterContext(ConverterContext context)
Gets the converter context which add a trailing "[]" to the context name.static ConverterContext
getElementConverterContext(ConverterContext context)
Gets the converter context which removes the trailing "[]" from the context name.static boolean
isArrayConverterContext(ConverterContext context)
Checks if the context is for an array.-
Methods inherited from class com.jidesoft.converter.AbstractContext
equals, getName, getUserObject, hashCode, setName, setUserObject, toString
-
-
-
-
Field Detail
-
DEFAULT_CONTEXT
public static ConverterContext DEFAULT_CONTEXT
Default converter context with empty name and no user object.
-
DEFAULT_CONTEXT_DYNAMIC_VALUE
@Deprecated public static ConverterContext DEFAULT_CONTEXT_DYNAMIC_VALUE
Deprecated.Default converter context with dynamic value to work with EditorContext#DEFAULT_CONTEXT_DYNAMIC_VALUE.
-
-
Constructor Detail
-
ConverterContext
public ConverterContext(java.lang.String name)
Creates a converter context with a name.- Parameters:
name
- the name of the converter context
-
ConverterContext
public ConverterContext(java.lang.String name, java.lang.Object object)
Creates a converter context with a name and an object.- Parameters:
name
- the name of the converter contextobject
- the user object. It can be used as any object to pass information along.
-
-
Method Detail
-
isArrayConverterContext
public static boolean isArrayConverterContext(ConverterContext context)
Checks if the context is for an array. By conversion, we put "[]" at the end of the converter context's name if the context is for an array data type. Please note, this is a conversion only. If developer chooses to not put "[]" at the end for their own customized context, this method will fail.- Parameters:
context
- the context.- Returns:
- true or false.
-
getElementConverterContext
public static ConverterContext getElementConverterContext(ConverterContext context)
Gets the converter context which removes the trailing "[]" from the context name.- Parameters:
context
- the context for an array type.- Returns:
- the converter context for the element type of an array.
-
getArrayConverterContext
public static ConverterContext getArrayConverterContext(ConverterContext context)
Gets the converter context which add a trailing "[]" to the context name.- Parameters:
context
- the context for the element type of an array.- Returns:
- the converter context the array of the element type.
-
-