.roboblender.3.0.1.source-code.AnnotationDatabaseImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of roboblender Show documentation
Show all versions of roboblender Show documentation
The annotation processor of RoboGuice
#if( $packageName )
package $packageName;
#end
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import com.google.inject.AnnotationDatabase;
import roboguice.fragment.FragmentUtil;
public class AnnotationDatabaseImpl extends AnnotationDatabase {
public void fillAnnotationClassesAndFieldsNames(HashMap>> mapAnnotationToMapClassWithInjectionNameToFieldSet) {
String annotationClassName = null;
Map> mapClassWithInjectionNameToFieldSet = null;
Set fieldNameSet = null;
#foreach( $annotationName in $mapAnnotationToMapClassWithInjectionNameToFieldSet.keySet() )
annotationClassName = "$annotationName";
mapClassWithInjectionNameToFieldSet = mapAnnotationToMapClassWithInjectionNameToFieldSet.get(annotationClassName);
if( mapClassWithInjectionNameToFieldSet == null ) {
mapClassWithInjectionNameToFieldSet = new HashMap>();
mapAnnotationToMapClassWithInjectionNameToFieldSet.put(annotationClassName, mapClassWithInjectionNameToFieldSet);
}
#foreach( $className in $mapAnnotationToMapClassWithInjectionNameToFieldSet.get($annotationName).keySet() )
fieldNameSet = new HashSet();
#foreach( $fieldName in $mapAnnotationToMapClassWithInjectionNameToFieldSet.get($annotationName).get($className) )
fieldNameSet.add("$fieldName");
#end
mapClassWithInjectionNameToFieldSet.put("$className", fieldNameSet);
#end
#end
}
public void fillAnnotationClassesAndMethods(HashMap>> mapAnnotationToMapClassWithInjectionNameToMethodsSet) {
String annotationClassName = null;
Map> mapClassWithInjectionNameToMethodSet = null;
Set methodSet = null;
#foreach( $annotationName in $mapAnnotationToMapClassWithInjectionNameToMethodSet.keySet() )
annotationClassName = "$annotationName";
mapClassWithInjectionNameToMethodSet = mapAnnotationToMapClassWithInjectionNameToMethodsSet.get(annotationClassName);
if( mapClassWithInjectionNameToMethodSet == null ) {
mapClassWithInjectionNameToMethodSet = new HashMap>();
mapAnnotationToMapClassWithInjectionNameToMethodsSet.put(annotationClassName, mapClassWithInjectionNameToMethodSet);
}
#foreach( $className in $mapAnnotationToMapClassWithInjectionNameToMethodSet.get($annotationName).keySet() )
methodSet = new HashSet();
#foreach( $method in $mapAnnotationToMapClassWithInjectionNameToMethodSet.get($annotationName).get($className) )
methodSet.add("$method");
#end
mapClassWithInjectionNameToMethodSet.put("$className", methodSet);
#end
#end
}
public void fillAnnotationClassesAndConstructors(HashMap>> mapAnnotationToMapClassWithInjectionNameToConstructorsSet) {
String annotationClassName = null;
Map> mapClassWithInjectionNameToConstructorSet = null;
Set constructorSet = null;
#foreach( $annotationName in $mapAnnotationToMapClassWithInjectionNameToConstructorSet.keySet() )
annotationClassName = "$annotationName";
mapClassWithInjectionNameToConstructorSet = mapAnnotationToMapClassWithInjectionNameToConstructorsSet.get(annotationClassName);
if( mapClassWithInjectionNameToConstructorSet == null ) {
mapClassWithInjectionNameToConstructorSet = new HashMap>();
mapAnnotationToMapClassWithInjectionNameToConstructorsSet.put(annotationClassName, mapClassWithInjectionNameToConstructorSet);
}
#foreach( $className in $mapAnnotationToMapClassWithInjectionNameToConstructorSet.get($annotationName).keySet() )
constructorSet = new HashSet();
#foreach( $constructor in $mapAnnotationToMapClassWithInjectionNameToConstructorSet.get($annotationName).get($className) )
constructorSet.add("$constructor");
#end
mapClassWithInjectionNameToConstructorSet.put("$className", constructorSet);
#end
#end
}
public void fillInjectableClasses(HashSet injectedClasses) {
#foreach( $className in $injectedClasses )
injectedClasses.add("$className");
#end
if(FragmentUtil.hasNative) {
injectedClasses.add("android.app.FragmentManager");
}
if(FragmentUtil.hasSupport) {
injectedClasses.add("android.support.v4.app.FragmentManager");
}
}
}