public class IceMapper
extends ome.util.ModelMapper
implements ome.util.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 java.util.Map<java.lang.Object,java.lang.Object> |
target2model |
static IceMapper.ReturnMapping |
UNMAPPED
Specifies a return type which should not be parsed.
|
static IceMapper.ReturnMapping |
VOID |
Constructor and Description |
---|
IceMapper() |
IceMapper(IceMapper.ReturnMapping mapping) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map |
c2c() |
boolean |
canMapReturnValue()
True if this instance has a
IceMapper.ReturnMapping |
omeis.providers.re.codomain.CodomainMapContext |
convert(CodomainMapContext ctx)
Converts the passed Ice Object and returns the converted object.
|
static RTime |
convert(java.util.Date date) |
static EventContext |
convert(ome.system.EventContext ctx) |
static ome.parameters.Filter |
convert(Filter f) |
static ome.parameters.Options |
convert(Options o) |
ome.parameters.Parameters |
convert(Parameters params) |
static Permissions |
convert(ome.model.internal.Permissions p) |
static ome.model.internal.Permissions |
convert(Permissions p) |
static omeis.providers.re.data.PlaneDef |
convert(PlaneDef def)
Converts the passed Ice Object and returns the converted object.
|
static ome.system.Principal |
convert(Principal old) |
static RGBBuffer |
convert(omeis.providers.re.RGBBuffer buffer) |
static Roles |
convert(ome.system.Roles roles) |
static java.sql.Timestamp |
convert(RTime time) |
ome.parameters.QueryParameter |
convert(java.lang.String key,
java.lang.Object o) |
static java.util.List<NamedValue> |
convertMapPairs(java.util.List<ome.xml.model.MapPair> map) |
static java.util.List<NamedValue> |
convertNamedValueList(java.util.List<ome.model.internal.NamedValue> map) |
static java.util.Map<java.lang.String,RString> |
convertStringStringMap(java.util.Map<java.lang.String,java.lang.String> map)
Convert a String→String map's values to
RString s. |
static ServerError |
fillServerError(ServerError se,
java.lang.Throwable t) |
ome.util.Filterable |
filter(java.lang.String fieldId,
ome.util.Filterable source) |
java.util.Collection |
findCollection(java.util.Collection source)
Overrides the findCollection logic of
ModelMapper , since all
Collection s should be List s in Ice. |
java.lang.Object |
fromRType(RType rt)
Uses the omero.rtypes hierarchy to properly convert any
RType to
its internal representation. |
Ice.UserException |
handleException(java.lang.Throwable t,
ome.system.OmeroContext ctx) |
java.lang.Object |
handleInput(java.lang.Class<?> p,
java.lang.Object arg) |
java.lang.Object |
handleOutput(java.lang.Class type,
java.lang.Object o) |
ServerError |
handleServerError(java.lang.Throwable t,
ome.system.OmeroContext ctx)
wraps any non-ServerError returned by
handleException(Throwable, OmeroContext) in an
InternalException . |
protected boolean |
hasntSeen(java.lang.Object o) |
boolean |
isImmutable(java.lang.Object obj) |
protected static boolean |
isNullablePrimitive(java.lang.Class<?> p) |
protected boolean |
isPrimitive(java.lang.Class<?> p) |
boolean |
isVoid()
Returns true only if the current mapping is the
VOID mapping. |
protected static boolean |
isWrapperArray(java.lang.Class<?> p) |
java.util.List |
map(ome.util.Filterable[] array) |
java.lang.Object |
mapReturnValue(java.lang.Object value)
Convert the given Object via the set
IceMapper.ReturnMapping . |
static java.lang.Class<? extends ome.model.IObject> |
omeroClass(java.lang.String className,
boolean strict) |
java.util.Collection |
reverse(java.util.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) . |
java.util.Collection |
reverse(java.util.Collection source,
java.lang.Class targetType)
Creates a collection assignable to the given type.
|
java.util.Map |
reverse(java.util.Map map) |
ome.util.Filterable |
reverse(ome.model.ModelBased source)
Copied from
ReverseModelMapper . |
java.lang.Object |
reverse(java.lang.Object source) |
java.lang.Object[] |
reverseArray(java.util.List list,
java.lang.Class type)
Supports the separate case of reversing for arrays.
|
static java.util.List<ome.model.internal.NamedValue> |
reverseNamedList(java.util.List<NamedValue> map) |
static java.util.Map<java.lang.String,java.lang.String> |
reverseStringStringMap(java.util.Map<java.lang.String,RString> rMap)
Reverse a String→String map's values from
RString s. |
void |
store(java.lang.Object source,
java.lang.Object target) |
RType |
toRType(java.lang.Object o) |
event2timestamp, filter, filter, findClass, findCollectionTarget, findKeyTarget, findMap, findTarget, map, map, map, nullSafeDouble, nullSafeFloat, nullSafeInt, nullSafeLong, stackAsString
public 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
protected java.util.Map<java.lang.Object,java.lang.Object> target2model
public IceMapper()
public IceMapper(IceMapper.ReturnMapping mapping)
public boolean isVoid()
VOID
mapping.public boolean canMapReturnValue()
IceMapper.ReturnMapping
public java.lang.Object mapReturnValue(java.lang.Object value) throws Ice.UserException
IceMapper.ReturnMapping
. Throws a
NullPointerException
if no mapping is set.Ice.UserException
public static ServerError fillServerError(ServerError se, java.lang.Throwable t)
public static java.lang.Class<? extends ome.model.IObject> omeroClass(java.lang.String className, boolean strict) throws ApiUsageException
ApiUsageException
public RType toRType(java.lang.Object o) throws ApiUsageException
ApiUsageException
public java.lang.Object fromRType(RType rt) throws ApiUsageException
RType
to
its internal representation. This requires that the instance properly
implement rtypes.Conversion
otherwise ApiUsageException
will be thrown.rt
- the wrapped valueApiUsageException
- if the given value is not wrappedpublic static EventContext convert(ome.system.EventContext ctx)
public static RGBBuffer convert(omeis.providers.re.RGBBuffer buffer)
public omeis.providers.re.codomain.CodomainMapContext convert(CodomainMapContext ctx)
ctx
- The object to convertApiUsageException
- Thrown if the slice is unknown.public static omeis.providers.re.data.PlaneDef convert(PlaneDef def) throws ApiUsageException
def
- The object to convertApiUsageException
- Thrown if the slice is unknown.public static ome.system.Principal convert(Principal old)
public static Roles convert(ome.system.Roles roles)
public static RTime convert(java.util.Date date)
public static java.sql.Timestamp convert(RTime time)
public ome.parameters.Parameters convert(Parameters params) throws ApiUsageException
ApiUsageException
public ome.parameters.QueryParameter convert(java.lang.String key, java.lang.Object o) throws ApiUsageException
ApiUsageException
public static ome.parameters.Options convert(Options o)
public static ome.parameters.Filter convert(Filter f)
public static java.util.List<NamedValue> convertNamedValueList(java.util.List<ome.model.internal.NamedValue> map)
public static java.util.List<NamedValue> convertMapPairs(java.util.List<ome.xml.model.MapPair> map)
public static java.util.Map<java.lang.String,RString> convertStringStringMap(java.util.Map<java.lang.String,java.lang.String> map)
RString
s.
null
values are dropped completely.map
- a mapnull
if map == null
public java.util.Collection findCollection(java.util.Collection source)
ModelMapper
, since all
Collection
s should be List
s in Ice.findCollection
in class ome.util.ModelMapper
public java.util.List map(ome.util.Filterable[] array)
public static Permissions convert(ome.model.internal.Permissions p)
public static ome.model.internal.Permissions convert(Permissions p)
public boolean isImmutable(java.lang.Object obj)
public java.lang.Object reverse(java.lang.Object source) throws ApiUsageException
ApiUsageException
public java.util.Collection reverse(java.util.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 ome.util.ReverseModelMapper
source
- the wrapped Collection
Collection
unwrappedpublic java.util.Collection reverse(java.util.Collection source, java.lang.Class targetType)
Set
and List
are supported, and HashSet
s and
ArrayList
s will be returned. The need for this arose from the
decision to have no Set
s in the Ice Java mapping.public java.lang.Object[] reverseArray(java.util.List list, java.lang.Class type) throws ServerError
reverse(Collection, Class)
and map(Filterable[])
.ServerError
public java.util.Map reverse(java.util.Map map)
public ome.util.Filterable reverse(ome.model.ModelBased source)
ReverseModelMapper
.reverse
in interface ome.util.ReverseModelMapper
public static java.util.Map<java.lang.String,java.lang.String> reverseStringStringMap(java.util.Map<java.lang.String,RString> rMap)
RString
s.
null
values are dropped completely.rMap
- a mapnull
if rMap == null
public static java.util.List<ome.model.internal.NamedValue> reverseNamedList(java.util.List<NamedValue> map)
public void store(java.lang.Object source, java.lang.Object target)
protected java.util.Map c2c()
c2c
in class ome.util.ModelMapper
public ome.util.Filterable filter(java.lang.String fieldId, ome.util.Filterable source)
filter
in interface ome.util.Filter
filter
in class ome.util.ModelMapper
protected boolean hasntSeen(java.lang.Object o)
hasntSeen
in class ome.util.ContextFilter
protected boolean isPrimitive(java.lang.Class<?> p)
protected static boolean isNullablePrimitive(java.lang.Class<?> p)
protected static boolean isWrapperArray(java.lang.Class<?> p)
public java.lang.Object handleInput(java.lang.Class<?> p, java.lang.Object arg) throws ServerError
ServerError
public java.lang.Object handleOutput(java.lang.Class type, java.lang.Object o) throws ServerError
ServerError
public ServerError handleServerError(java.lang.Throwable t, ome.system.OmeroContext ctx)
handleException(Throwable, OmeroContext)
in an
InternalException
.public Ice.UserException handleException(java.lang.Throwable t, ome.system.OmeroContext ctx)