The list of methods to do Object Create are organized into topic(s).
T
as(Class cls, Object o) Returns the specified object as the specified class or returns null if the cast is not supported.
if (cls.isInstance(o)) {
return cls.cast(o);
return null;
T
as(Class targetClass, Object entity) Casts entity to targetClass or return null, if it is impossible
T result = null;
if ((entity != null) && targetClass.isAssignableFrom(entity.getClass())) {
result = (T) entity;
return result;
T
as(Class type, U o) if o is of the given type, returns o cast to it; otherwise returns null.
if (type.isInstance(o)) {
return (T) o;
return null;
T
as(Object o, Class clazz) Attempts to cast to the specified type, returns null if not castable.
if (o == null)
return null;
if (!clazz.isAssignableFrom(o.getClass()))
return null;
return (T) o;