public class IceMapper extends ModelMapper implements ReverseModelMapper
IceMapper instance can also be configured to handle
return value mapping, though by default an exception will be thrown if
mapReturnValue(Object) is called.| Modifier and Type | Class and Description |
|---|---|
static interface |
IceMapper.ReturnMapping |
| Modifier and Type | Field and Description |
|---|---|
static IceMapper.ReturnMapping |
FILTERABLE |
static IceMapper.ReturnMapping |
FILTERABLE_ARRAY |
static IceMapper.ReturnMapping |
FILTERABLE_COLLECTION |
static IceMapper.ReturnMapping |
FILTERABLE_PRIMITIVE_MAP |
static IceMapper.ReturnMapping |
LISTOBJECTARRAY_TO_RTYPESEQSEQ |
static IceMapper.ReturnMapping |
OBJECT_TO_RTYPE |
static IceMapper.ReturnMapping |
OBJECTARRAY_TO_RTYPESEQ |
static IceMapper.ReturnMapping |
PRIMITIVE |
static IceMapper.ReturnMapping |
PRIMITIVE_FILTERABLE_COLLECTION_MAP |
static IceMapper.ReturnMapping |
PRIMITIVE_MAP |
static IceMapper.ReturnMapping |
RTYPEDICT |
static IceMapper.ReturnMapping |
STRING_TO_RSTRING |
protected Map<Object,Object> |
target2model |
static IceMapper.ReturnMapping |
UNMAPPED
Specifies a return type which should not be parsed.
|
static IceMapper.ReturnMapping |
VOID |
model2target_cache, _context| Constructor and Description |
|---|
IceMapper() |
IceMapper(IceMapper.ReturnMapping mapping) |
| Modifier and Type | Method and Description |
|---|---|
protected Map |
c2c()
TODO identity versus null mappings
|
boolean |
canMapReturnValue()
True if this instance has a
IceMapper.ReturnMapping |
CodomainMapContext |
convert(omero.romio.CodomainMapContext ctx)
Converts the passed Ice Object and returns the converted object.
|
static omero.RTime |
convert(Date date) |
static omero.sys.EventContext |
convert(EventContext ctx) |
static Filter |
convert(omero.sys.Filter f) |
static Options |
convert(omero.sys.Options o) |
Parameters |
convert(omero.sys.Parameters params) |
static omero.model.Permissions |
convert(Permissions p) |
static Permissions |
convert(omero.model.Permissions p) |
static PlaneDef |
convert(omero.romio.PlaneDef def)
Converts the passed Ice Object and returns the converted object.
|
static Principal |
convert(omero.sys.Principal old) |
static omero.romio.RGBBuffer |
convert(RGBBuffer buffer) |
static omero.sys.Roles |
convert(Roles roles) |
static Timestamp |
convert(omero.RTime time) |
QueryParameter |
convert(String key,
Object o) |
static List<omero.model.NamedValue> |
convertMapPairs(List<ome.xml.model.MapPair> map) |
static List<omero.model.NamedValue> |
convertNamedValueList(List<NamedValue> map) |
static Map<String,omero.RString> |
convertStringStringMap(Map<String,String> map)
Convert a String→String map's values to
RStrings. |
static omero.ServerError |
fillServerError(omero.ServerError se,
Throwable t) |
Filterable |
filter(String fieldId,
Filterable source) |
Collection |
findCollection(Collection source)
|
Object |
fromRType(omero.RType rt)
Uses the omero.rtypes hierarchy to properly convert any
RType to
its internal representation. |
Ice.UserException |
handleException(Throwable t,
OmeroContext ctx) |
Object |
handleInput(Class<?> p,
Object arg) |
Object |
handleOutput(Class type,
Object o) |
omero.ServerError |
handleServerError(Throwable t,
OmeroContext ctx)
wraps any non-ServerError returned by
handleException(Throwable, OmeroContext) in an
InternalException. |
protected boolean |
hasntSeen(Object o) |
boolean |
isImmutable(Object obj) |
protected static boolean |
isNullablePrimitive(Class<?> p) |
protected boolean |
isPrimitive(Class<?> p) |
boolean |
isVoid()
Returns true only if the current mapping is the
VOID mapping. |
protected static boolean |
isWrapperArray(Class<?> p) |
List |
map(Filterable[] array) |
Object |
mapReturnValue(Object value)
Convert the given Object via the set
IceMapper.ReturnMapping. |
static Class<? extends IObject> |
omeroClass(String className,
boolean strict) |
Collection |
reverse(Collection source)
Copied from
ModelMapper.findCollection(Collection) This could be
unified in that a method findCollection(Collection, Map) was added with
ModelMapper calling findCollection(source, model2target)
and reverseCollection(Collection) calling
findCollection(source,target2model). |
Collection |
reverse(Collection source,
Class targetType)
Creates a collection assignable to the given type.
|
Map |
reverse(Map map) |
Filterable |
reverse(ModelBased source)
Copied from
ReverseModelMapper. |
Object |
reverse(Object source) |
Object[] |
reverseArray(List list,
Class type)
Supports the separate case of reversing for arrays.
|
static List<NamedValue> |
reverseNamedList(List<omero.model.NamedValue> map) |
static Map<String,String> |
reverseStringStringMap(Map<String,omero.RString> rMap)
Reverse a String→String map's values from
RStrings. |
void |
store(Object source,
Object target) |
omero.RType |
toRType(Object o) |
event2timestamp, filter, filter, findClass, findCollectionTarget, findKeyTarget, findMap, findTarget, map, map, map, nullSafeDouble, nullSafeFloat, nullSafeInt, nullSafeLong, stackAsStringaddSeen, afterFilter, beforeFilter, currentContext, doFilter, doFilter, doFilter, enter, exit, filter, filter, pop, previousContext, pushpublic static final IceMapper.ReturnMapping VOID
public static final IceMapper.ReturnMapping FILTERABLE
public static final IceMapper.ReturnMapping FILTERABLE_ARRAY
public static final IceMapper.ReturnMapping FILTERABLE_COLLECTION
public static final IceMapper.ReturnMapping OBJECTARRAY_TO_RTYPESEQ
public static final IceMapper.ReturnMapping LISTOBJECTARRAY_TO_RTYPESEQSEQ
public static final IceMapper.ReturnMapping OBJECT_TO_RTYPE
public static final IceMapper.ReturnMapping STRING_TO_RSTRING
public static final IceMapper.ReturnMapping UNMAPPED
public static final IceMapper.ReturnMapping PRIMITIVE
public static final IceMapper.ReturnMapping PRIMITIVE_MAP
public static final IceMapper.ReturnMapping FILTERABLE_PRIMITIVE_MAP
public static final IceMapper.ReturnMapping PRIMITIVE_FILTERABLE_COLLECTION_MAP
public static final IceMapper.ReturnMapping RTYPEDICT
public IceMapper()
public IceMapper(IceMapper.ReturnMapping mapping)
public boolean isVoid()
VOID mapping.public boolean canMapReturnValue()
IceMapper.ReturnMappingpublic Object mapReturnValue(Object value) throws Ice.UserException
IceMapper.ReturnMapping. Throws a
NullPointerException if no mapping is set.Ice.UserExceptionpublic static omero.ServerError fillServerError(omero.ServerError se,
Throwable t)
public static Class<? extends IObject> omeroClass(String className, boolean strict) throws omero.ApiUsageException
omero.ApiUsageExceptionpublic omero.RType toRType(Object o) throws omero.ApiUsageException
omero.ApiUsageExceptionpublic Object fromRType(omero.RType rt) throws omero.ApiUsageException
RType to
its internal representation. This requires that the instance properly
implement rtypes.Conversion otherwise ApiUsageException
will be thrown.rt - the wrapped valueomero.ApiUsageException - if the given value is not wrappedpublic static omero.sys.EventContext convert(EventContext ctx)
public static omero.romio.RGBBuffer convert(RGBBuffer buffer)
public CodomainMapContext convert(omero.romio.CodomainMapContext ctx)
ctx - The object to convertomero.ApiUsageException - Thrown if the slice is unknown.public static PlaneDef convert(omero.romio.PlaneDef def) throws omero.ApiUsageException
def - The object to convertomero.ApiUsageException - Thrown if the slice is unknown.public static Principal convert(omero.sys.Principal old)
public static omero.sys.Roles convert(Roles roles)
public static omero.RTime convert(Date date)
public static Timestamp convert(omero.RTime time)
public Parameters convert(omero.sys.Parameters params) throws omero.ApiUsageException
omero.ApiUsageExceptionpublic QueryParameter convert(String key, Object o) throws omero.ApiUsageException
omero.ApiUsageExceptionpublic static Options convert(omero.sys.Options o)
public static Filter convert(omero.sys.Filter f)
public static List<omero.model.NamedValue> convertNamedValueList(List<NamedValue> map)
public static List<omero.model.NamedValue> convertMapPairs(List<ome.xml.model.MapPair> map)
public static Map<String,omero.RString> convertStringStringMap(Map<String,String> map)
RStrings.
null values are dropped completely.map - a mapnull if map == nullpublic Collection findCollection(Collection source)
findCollection in class ModelMapperpublic List map(Filterable[] array)
public static omero.model.Permissions convert(Permissions p)
public static Permissions convert(omero.model.Permissions p)
public boolean isImmutable(Object obj)
public Object reverse(Object source) throws omero.ApiUsageException
omero.ApiUsageExceptionpublic Collection reverse(Collection source)
ModelMapper.findCollection(Collection) This could be
unified in that a method findCollection(Collection, Map) was added with
ModelMapper calling findCollection(source, model2target)
and reverseCollection(Collection) calling
findCollection(source,target2model).reverse in interface ReverseModelMappersource - the wrapped CollectionCollection unwrappedpublic Collection reverse(Collection source, Class targetType)
Set and List are supported, and HashSets and
ArrayLists will be returned. The need for this arose from the
decision to have no Sets in the Ice Java mapping.public Object[] reverseArray(List list, Class type) throws omero.ServerError
reverse(Collection, Class) and map(Filterable[]).omero.ServerErrorpublic Filterable reverse(ModelBased source)
ReverseModelMapper.reverse in interface ReverseModelMapperpublic static Map<String,String> reverseStringStringMap(Map<String,omero.RString> rMap)
RStrings.
null values are dropped completely.rMap - a mapnull if rMap == nullpublic static List<NamedValue> reverseNamedList(List<omero.model.NamedValue> map)
protected Map c2c()
ModelMapperc2c in class ModelMapperIObject classes ModelBased classes.public Filterable filter(String fieldId, Filterable source)
filter in interface Filterfilter in class ModelMapperprotected boolean hasntSeen(Object o)
hasntSeen in class ContextFilterprotected boolean isPrimitive(Class<?> p)
protected static boolean isNullablePrimitive(Class<?> p)
protected static boolean isWrapperArray(Class<?> p)
public Object handleInput(Class<?> p, Object arg) throws omero.ServerError
omero.ServerErrorpublic Object handleOutput(Class type, Object o) throws omero.ServerError
omero.ServerErrorpublic omero.ServerError handleServerError(Throwable t, OmeroContext ctx)
handleException(Throwable, OmeroContext) in an
InternalException.public Ice.UserException handleException(Throwable t, OmeroContext ctx)
Version: 5.4.0-ice35-b74
Copyright © 2017 The University of Dundee & Open Microscopy Environment. All Rights Reserved.