|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.iqual.chaplin.DynaCastUtils
public class DynaCastUtils
This class introduces the $ utility static method. This method can be used in situations when it is not possible
to cast an object directly to the type. You can use this method also when you do not want to assign null
values to the context local variables because it results in warnings that the variable is being used uninitialized - ie.
it serves as a sort of dummy plug.
This static import is assumed:
import static org.iqual.chaplin.DynaCastUtils.$;
Example 1 - "incorvertible" types made convertible:
File file = (File)$("addresses.txt")
Example 2 - context local variable "appears" initialized to the code inspector (no warning):
String $userName = $();
System.out.println(userName);
| Field Summary | |
|---|---|
static Object |
$
|
| Constructor Summary | |
|---|---|
DynaCastUtils()
|
|
| Method Summary | ||
|---|---|---|
static
|
$()
|
|
static
|
$(Class<E> ec,
Object... args)
|
|
static
|
$(Object... args)
|
|
static Composite |
$$(Object... args)
|
|
static String |
$alias(Object instance)
|
|
static
|
$alias(String aliasName,
T instance)
|
|
static
|
$bind(Object composite,
Object... boundComponents)
Bind the components to the composite. |
|
static boolean |
$contains(Object composite,
Class componentClass)
|
|
static
|
$context()
|
|
static MessageReceiver |
$declass(Object object)
|
|
static void |
$disjoin(Object component)
Pulls the component out of the composite. |
|
static
|
$emitter(Object instance)
|
|
static Object |
$for(String alias,
Object component)
Filters out all messages whose source component is not aliased as alias. |
|
static boolean |
$hasVar(Object object,
String varName)
|
|
static void |
$join(Object newComponent,
int index,
Object companion,
String name)
Inserts the component to the composite. |
|
static void |
$join(Object component,
Object companion)
Attaches the component to the composite. |
|
static void |
$join(Object newComponent,
Object companion,
String name)
Attaches the component to the composite. |
|
static
|
$meta(Object instance,
Object key)
|
|
static void |
$meta(Object instance,
Object key,
Object value)
Sets the role name of the component in the composite. |
|
static String |
$name(Object instance)
|
|
static
|
$name(String name,
T instance)
|
|
static MessageReceiver |
$named(String name,
Class context,
Object value)
|
|
static MessageReceiver |
$named(String name,
Object value)
|
|
static void |
$next(MessageReplies replies,
Object... args)
|
|
static
|
$next(Object... args)
|
|
static
|
$proxy(Class<T> intf,
Object object)
|
|
static String |
$qrole(Object instance)
|
|
static String |
$role(Object instance)
|
|
static
|
$role(String roleName,
T instance)
|
|
static void |
$unbind(Object composite)
|
|
static
|
$var(Object object,
String name)
Defines a new var. |
|
static Map<?,?> |
createMapFromCollection(Iterable<?> iterable)
Create a map from a collection. |
|
static Composite |
getComposite(Object object)
|
|
static Class |
getPrimitiveType(String type)
|
|
static Class[] |
getTypesArrayFromObjects(Object[] objects,
Class[] defaultTypes)
|
|
static boolean |
isEmptyObjectArray(Object arg)
|
|
static boolean |
isInComposite(Object object)
|
|
static MessageReceiver |
makeReceiver(Object component)
|
|
static Object |
resolveName(Object elem)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Object $
| Constructor Detail |
|---|
public DynaCastUtils()
| Method Detail |
|---|
public static Composite $$(Object... args)
public static <T> T $(Object... args)
public static <T> T $()
public static void $next(MessageReplies replies,
Object... args)
public static <T> T $next(Object... args)
public static <T> T $context()
public static <T,E extends Throwable> T $(Class<E> ec,
Object... args)
throws E extends Throwable
E extends Throwablepublic static Class getPrimitiveType(String type)
public static Class[] getTypesArrayFromObjects(Object[] objects,
Class[] defaultTypes)
public static <T> T $bind(Object composite,
Object... boundComponents)
composite - boundComponents -
public static void $unbind(Object composite)
public static MessageReceiver makeReceiver(Object component)
public static MessageReceiver $named(String name,
Class context,
Object value)
public static MessageReceiver $named(String name,
Object value)
public static MessageReceiver $declass(Object object)
object - the object which receives messages with stripped information on the message classification.
object argument. It allows processing messages
which would be otherwise impossible because of the message classification.public static boolean isEmptyObjectArray(Object arg)
public static boolean isInComposite(Object object)
public static Composite getComposite(Object object)
public static <T> T $proxy(Class<T> intf,
Object object)
public static boolean $contains(Object composite,
Class componentClass)
composite - the compositecomponentClass - the component clas
public static <T> T $emitter(Object instance)
instance - a component in a composite context or a composite context
public static <T> T $meta(Object instance,
Object key)
public static void $meta(Object instance,
Object key,
Object value)
instance - key - value -
public static <T> T $name(String name,
T instance)
name - instance -
public static String $name(Object instance)
instance -
public static <T> T $role(String roleName,
T instance)
roleName - instance -
public static String $role(Object instance)
public static String $qrole(Object instance)
instance - the instance in a composite
public static <T> T $alias(String aliasName,
T instance)
public static String $alias(Object instance)
public static Object $for(String alias,
Object component)
alias.
alias - the component's aliascomponent - the component
public static void $disjoin(Object component)
component - the component
public static void $join(Object component,
Object companion)
component - the component to be inserted to the compositecompanion - the companion compoent
public static void $join(Object newComponent,
Object companion,
String name)
newComponent - the component to be inserted to the compositecompanion - the companion compoentname - the name (role) of the component in the composite
public static void $join(Object newComponent,
int index,
Object companion,
String name)
newComponent - the component to be inserted to the compositeindex - the index at which the component is inserted. The value -1 means that the component is appended at the end.companion - the companion compoentname - the name (role) of the component in the compositepublic static Map<?,?> createMapFromCollection(Iterable<?> iterable)
iterable -
public static Object resolveName(Object elem)
public static <T> Var<T> $var(Object object,
String name)
T - the type of the varobject - the objectname - the name of the var
Var
public static boolean $hasVar(Object object,
String varName)
object - the objectvarName - the name of the var
Var
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||