Package jadex.micro
Class MicroClassReader
- java.lang.Object
-
- jadex.micro.MicroClassReader
-
- Direct Known Subclasses:
BDIClassReader
public class MicroClassReader extends java.lang.ObjectReads micro agent classes and generates a model from metainfo and annotations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMicroClassReader.DummyClassLoader
-
Constructor Summary
Constructors Constructor Description MicroClassReader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidcheckAndAddRequiredServiceInfo(RequiredServiceInfo rsis, java.util.Map<java.lang.String,java.lang.Object> rsers, java.lang.ClassLoader cl)protected voidcheckMethodReturnType(java.lang.Class<? extends java.lang.annotation.Annotation> ann, java.lang.reflect.Method m, java.lang.ClassLoader cl)Check, if the return type of the agent method is acceptable.static RequiredServiceBindingcreateBinding(RequiredService rq)Create a service binding.protected ComponentInstanceInfocreateComponentInstanceInfo(Component comp)Create component instance info from component annotation.static ComponentInstanceInfocreateComponentInstanceInfo(CreationInfo comp)Create component instance info from creation info annotation.static ProvidedServiceImplementationcreateImplementation(Implementation impl, java.lang.Class<?> cma)Create a service implementation.protected static java.util.List<NFRPropertyInfo>createNFRProperties(NFRProperty[] nfrp)Create req service props.protected static ProvidedServiceInfocreateProvidedServiceInfo(ProvidedService prov)Create info from annotation.protected static RequiredServiceInfocreateRequiredServiceInfo(RequiredService rs, java.lang.ClassLoader cl)Create a required service info from annotation.static UnparsedExpression[]createUnparsedExpressions(Value[] values)Create unparsed expressions.protected java.lang.ObjectevaluateExpression(java.lang.String exp, java.lang.String[] imports, IValueFetcher fetcher, java.lang.ClassLoader classloader)Evaluate an expression string (using "" -> null mapping) as annotations do not support null values.protected voidfillMicroModelFromAnnotations(MicroModel micromodel, java.lang.String model, java.lang.Class<?> clazz, java.lang.ClassLoader cl)Fill the model details using annotation.static voidfindInjections(java.lang.Class<?> cma, java.lang.ClassLoader cl, InjectionInfoHolder ii, java.util.Map<java.lang.String,java.lang.Object> rsers)Find injections:static <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<?> clazz, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)static <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.Class<?> clazz, java.lang.Class<T> anclazz, java.lang.ClassLoader cl1, java.lang.ClassLoader cl2)static <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.reflect.Constructor<?> c, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)static <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.reflect.Field f, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)static <T extends java.lang.annotation.Annotation>
TgetAnnotation(java.lang.reflect.Method m, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)static java.lang.Class<?>getClass(java.lang.Class<?> clazz, java.lang.ClassLoader cl)static java.lang.Class<?>[]getClassArray(java.lang.Class<?>[] clazzes, java.lang.ClassLoader cl)protected java.lang.Class<?>getMicroAgentClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)Get the mirco agent class.protected java.util.List<java.lang.Object>getOrCreateList(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Get or create a list.protected java.util.Map<java.lang.String,java.lang.Object>getOrCreateMap(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Get or create a map.protected java.util.Set<java.lang.Object>getOrCreateSet(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Get or create a set.static java.lang.annotation.Annotation[][]getParameterAnnotations(java.lang.reflect.Constructor c, java.lang.ClassLoader cl)static java.lang.annotation.Annotation[][]getParameterAnnotations(java.lang.reflect.Method m, java.lang.ClassLoader cl)static <T extends java.lang.annotation.Annotation>
TgetProxyAnnotation(T an, java.lang.ClassLoader cl)Gets proxy annotation that can be invoked by corresponding classloader.protected static java.lang.StringguessName(java.lang.String methodname)protected static java.lang.Class<?>guessParameterType(java.lang.Class<?>[] ptypes, java.lang.ClassLoader cl)static booleanisAnnotationPresent(java.lang.Class<?> clazz, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)static booleanisAnnotationPresent(java.lang.reflect.Constructor<?> con, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)static booleanisAnnotationPresent(java.lang.reflect.Field f, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)static booleanisAnnotationPresent(java.lang.reflect.Method m, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)protected static booleanisClassLoaderCompatible(java.lang.Class<?> clazz, java.lang.ClassLoader cl)protected MicroModelread(java.lang.String model, java.lang.Class<?> cma, java.lang.ClassLoader classloader, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)Load the model.MicroModelread(java.lang.String model, java.lang.Object pojo, java.lang.String[] imports, java.lang.ClassLoader classloader, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)Load a model.
-
-
-
Method Detail
-
read
public MicroModel read(java.lang.String model, java.lang.Object pojo, java.lang.String[] imports, java.lang.ClassLoader classloader, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Load a model.- Parameters:
model- The model (e.g. file name).The- imports (if any).- Returns:
- The loaded model.
-
read
protected MicroModel read(java.lang.String model, java.lang.Class<?> cma, java.lang.ClassLoader classloader, IResourceIdentifier rid, IComponentIdentifier root, java.util.List<IComponentFeatureFactory> features)
Load the model.
-
fillMicroModelFromAnnotations
protected void fillMicroModelFromAnnotations(MicroModel micromodel, java.lang.String model, java.lang.Class<?> clazz, java.lang.ClassLoader cl)
Fill the model details using annotation.
-
createProvidedServiceInfo
protected static ProvidedServiceInfo createProvidedServiceInfo(ProvidedService prov)
Create info from annotation.
-
checkMethodReturnType
protected void checkMethodReturnType(java.lang.Class<? extends java.lang.annotation.Annotation> ann, java.lang.reflect.Method m, java.lang.ClassLoader cl)Check, if the return type of the agent method is acceptable.
-
createRequiredServiceInfo
protected static RequiredServiceInfo createRequiredServiceInfo(RequiredService rs, java.lang.ClassLoader cl)
Create a required service info from annotation.
-
getOrCreateMap
protected java.util.Map<java.lang.String,java.lang.Object> getOrCreateMap(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Get or create a map.
-
getOrCreateList
protected java.util.List<java.lang.Object> getOrCreateList(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Get or create a list.
-
getOrCreateSet
protected java.util.Set<java.lang.Object> getOrCreateSet(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> map)Get or create a set.
-
evaluateExpression
protected java.lang.Object evaluateExpression(java.lang.String exp, java.lang.String[] imports, IValueFetcher fetcher, java.lang.ClassLoader classloader)Evaluate an expression string (using "" -> null mapping) as annotations do not support null values.
-
createImplementation
public static ProvidedServiceImplementation createImplementation(Implementation impl, java.lang.Class<?> cma)
Create a service implementation.
-
createBinding
public static RequiredServiceBinding createBinding(RequiredService rq)
Create a service binding.
-
createNFRProperties
protected static java.util.List<NFRPropertyInfo> createNFRProperties(NFRProperty[] nfrp)
Create req service props.
-
createComponentInstanceInfo
protected ComponentInstanceInfo createComponentInstanceInfo(Component comp)
Create component instance info from component annotation.
-
createComponentInstanceInfo
public static ComponentInstanceInfo createComponentInstanceInfo(CreationInfo comp)
Create component instance info from creation info annotation.
-
createUnparsedExpressions
public static UnparsedExpression[] createUnparsedExpressions(Value[] values)
Create unparsed expressions.
-
getMicroAgentClass
protected java.lang.Class<?> getMicroAgentClass(java.lang.String clname, java.lang.String[] imports, java.lang.ClassLoader classloader)Get the mirco agent class.
-
isAnnotationPresent
public static boolean isAnnotationPresent(java.lang.Class<?> clazz, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)
-
isAnnotationPresent
public static boolean isAnnotationPresent(java.lang.reflect.Field f, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)
-
isAnnotationPresent
public static boolean isAnnotationPresent(java.lang.reflect.Method m, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)
-
isAnnotationPresent
public static boolean isAnnotationPresent(java.lang.reflect.Constructor<?> con, java.lang.Class<? extends java.lang.annotation.Annotation> anclazz, java.lang.ClassLoader cl)
-
getAnnotation
public static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<?> clazz, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)
-
getAnnotation
public static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.reflect.Field f, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)
-
getAnnotation
public static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.reflect.Method m, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)
-
getAnnotation
public static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.reflect.Constructor<?> c, java.lang.Class<T> anclazz, java.lang.ClassLoader cl)
-
getParameterAnnotations
public static java.lang.annotation.Annotation[][] getParameterAnnotations(java.lang.reflect.Method m, java.lang.ClassLoader cl)
-
getParameterAnnotations
public static java.lang.annotation.Annotation[][] getParameterAnnotations(java.lang.reflect.Constructor c, java.lang.ClassLoader cl)
-
getAnnotation
public static <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.Class<?> clazz, java.lang.Class<T> anclazz, java.lang.ClassLoader cl1, java.lang.ClassLoader cl2)
-
getClass
public static java.lang.Class<?> getClass(java.lang.Class<?> clazz, java.lang.ClassLoader cl)
-
getClassArray
public static java.lang.Class<?>[] getClassArray(java.lang.Class<?>[] clazzes, java.lang.ClassLoader cl)
-
getProxyAnnotation
public static <T extends java.lang.annotation.Annotation> T getProxyAnnotation(T an, java.lang.ClassLoader cl)Gets proxy annotation that can be invoked by corresponding classloader.- Returns:
- ret
-
isClassLoaderCompatible
protected static boolean isClassLoaderCompatible(java.lang.Class<?> clazz, java.lang.ClassLoader cl)
-
findInjections
public static void findInjections(java.lang.Class<?> cma, java.lang.ClassLoader cl, InjectionInfoHolder ii, java.util.Map<java.lang.String,java.lang.Object> rsers)Find injections:- Parameters:
cma-cl-ii-rsers-
-
guessName
protected static java.lang.String guessName(java.lang.String methodname)
-
guessParameterType
protected static java.lang.Class<?> guessParameterType(java.lang.Class<?>[] ptypes, java.lang.ClassLoader cl)
-
checkAndAddRequiredServiceInfo
public static void checkAndAddRequiredServiceInfo(RequiredServiceInfo rsis, java.util.Map<java.lang.String,java.lang.Object> rsers, java.lang.ClassLoader cl)
- Parameters:
rsis-rsers-cl-
-
-