Package jadex.micro
Class MicroClassReader
java.lang.Object
jadex.micro.MicroClassReader
Reads micro agent classes and generates a model from metainfo and annotations.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkMethodReturnType
(Class<? extends Annotation> ann, Method m, ClassLoader cl) Check, if the return type of the agent method is acceptable.static jadex.common.UnparsedExpression
convertNameValue
(jadex.model.annotation.NameValue nval) Convert a name value annotation to an unparsed expression.protected jadex.model.modelinfo.ComponentInstanceInfo
Create component instance info from component annotation.static jadex.model.modelinfo.ComponentInstanceInfo
Create component instance info from creation info annotation.static jadex.common.UnparsedExpression[]
createUnparsedExpressions
(jadex.model.annotation.NameValue[] values) Create unparsed expressions.static jadex.common.UnparsedExpression[]
createUnparsedExpressions
(jadex.model.annotation.Value[] values) Create unparsed expressions.static List
<jadex.common.UnparsedExpression> createUnparsedExpressionsList
(jadex.model.annotation.NameValue[] values) Create unparsed expressions.protected Object
evaluateExpression
(String exp, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Evaluate an expression string (using "" -> null mapping) as annotations do not support null values.protected void
fillMicroModelFromAnnotations
(MicroModel micromodel, String model, Class<?> clazz, ClassLoader cl) Fill the model details using annotation.static void
findInjections
(Class<?> cma, ClassLoader cl, InjectionInfoHolder ii) Find injections:static <T extends Annotation>
TgetAnnotation
(Class<?> clazz, Class<T> anclazz, ClassLoader cl) static <T extends Annotation>
TgetAnnotation
(Class<?> clazz, Class<T> anclazz, ClassLoader cl1, ClassLoader cl2) static <T extends Annotation>
TgetAnnotation
(Constructor<?> c, Class<T> anclazz, ClassLoader cl) static <T extends Annotation>
TgetAnnotation
(Field f, Class<T> anclazz, ClassLoader cl) static <T extends Annotation>
TgetAnnotation
(Method m, Class<T> anclazz, ClassLoader cl) static <T extends Annotation>
T[]getAnnotations
(Class<?> clazz, Class<T> anclazz, ClassLoader cl) static Class
<?> getClass
(Class<?> clazz, ClassLoader cl) static Class<?>[]
getClassArray
(Class<?>[] clazzes, ClassLoader cl) protected Class
<?> getMicroAgentClass
(String clname, String[] imports, ClassLoader classloader) Get the mirco agent class.getOrCreateList
(String name, Map<String, Object> map) Get or create a list.getOrCreateMap
(String name, Map<String, Object> map) Get or create a map.getOrCreateSet
(String name, Map<String, Object> map) Get or create a set.static Annotation[][]
static Annotation[][]
static <T extends Annotation>
TgetProxyAnnotation
(T an, ClassLoader cl) Gets proxy annotation that can be invoked by corresponding classloader.static String
static boolean
isAnnotationPresent
(Class<?> clazz, Class<? extends Annotation> anclazz, ClassLoader cl) static boolean
isAnnotationPresent
(Constructor<?> con, Class<? extends Annotation> anclazz, ClassLoader cl) static boolean
isAnnotationPresent
(Field f, Class<? extends Annotation> anclazz, ClassLoader cl) static boolean
isAnnotationPresent
(Method m, Class<? extends Annotation> anclazz, ClassLoader cl) protected static boolean
isClassLoaderCompatible
(Class<?> clazz, ClassLoader cl) protected MicroModel
read
(String model, Class<?> cma, ClassLoader classloader) Load the model.read
(String model, Object pojo, String[] imports, ClassLoader classloader) Load a model.
-
Constructor Details
-
MicroClassReader
public MicroClassReader()
-
-
Method Details
-
read
Load a model.- Parameters:
model
- The model (e.g. file name).The
- imports (if any).- Returns:
- The loaded model.
-
read
Load the model. -
fillMicroModelFromAnnotations
protected void fillMicroModelFromAnnotations(MicroModel micromodel, String model, Class<?> clazz, ClassLoader cl) Fill the model details using annotation. -
checkMethodReturnType
Check, if the return type of the agent method is acceptable. -
getOrCreateMap
Get or create a map. -
getOrCreateList
Get or create a list. -
getOrCreateSet
Get or create a set. -
evaluateExpression
protected Object evaluateExpression(String exp, String[] imports, jadex.common.IValueFetcher fetcher, ClassLoader classloader) Evaluate an expression string (using "" -> null mapping) as annotations do not support null values. -
createComponentInstanceInfo
Create component instance info from component annotation. -
createComponentInstanceInfo
public static jadex.model.modelinfo.ComponentInstanceInfo createComponentInstanceInfo(CreationInfo comp) Create component instance info from creation info annotation. -
createUnparsedExpressions
public static jadex.common.UnparsedExpression[] createUnparsedExpressions(jadex.model.annotation.Value[] values) Create unparsed expressions. -
getMicroAgentClass
Get the mirco agent class. -
isAnnotationPresent
public static boolean isAnnotationPresent(Class<?> clazz, Class<? extends Annotation> anclazz, ClassLoader cl) -
isAnnotationPresent
public static boolean isAnnotationPresent(Field f, Class<? extends Annotation> anclazz, ClassLoader cl) -
isAnnotationPresent
public static boolean isAnnotationPresent(Method m, Class<? extends Annotation> anclazz, ClassLoader cl) -
isAnnotationPresent
public static boolean isAnnotationPresent(Constructor<?> con, Class<? extends Annotation> anclazz, ClassLoader cl) -
getAnnotation
public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> anclazz, ClassLoader cl) -
getAnnotations
public static <T extends Annotation> T[] getAnnotations(Class<?> clazz, Class<T> anclazz, ClassLoader cl) -
getAnnotation
-
getAnnotation
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Constructor<?> c, Class<T> anclazz, ClassLoader cl) -
getParameterAnnotations
-
getParameterAnnotations
-
getAnnotation
public static <T extends Annotation> T getAnnotation(Class<?> clazz, Class<T> anclazz, ClassLoader cl1, ClassLoader cl2) -
getClass
-
getClassArray
-
getProxyAnnotation
Gets proxy annotation that can be invoked by corresponding classloader.- Returns:
- ret
-
isClassLoaderCompatible
-
findInjections
Find injections:- Parameters:
cma
-cl
-ii
-rsers
-
-
guessName
-
createUnparsedExpressions
public static jadex.common.UnparsedExpression[] createUnparsedExpressions(jadex.model.annotation.NameValue[] values) Create unparsed expressions. -
createUnparsedExpressionsList
public static List<jadex.common.UnparsedExpression> createUnparsedExpressionsList(jadex.model.annotation.NameValue[] values) Create unparsed expressions. -
convertNameValue
public static jadex.common.UnparsedExpression convertNameValue(jadex.model.annotation.NameValue nval) Convert a name value annotation to an unparsed expression.- Parameters:
nval
- The name value annotation.- Returns:
- The expression.
-