public String[] getInjectedParams() { if (injectedParams == null) { return new String[0]; } String[] params = new String[injectedParams.length]; for(int i = 0; i < params.length; i++) { params[i] = injectedParams[i].getName(); } return params; } public Class<?> getSource() {
public static Type findClosestPublicTypeExposing(Type type, Class<?> expose) { return findTypeInHierarchy(type, new TypeIsPublicAndImplement(expose)); }
@Override public SignatureVisitor visitParameterType() { return new AppendType(); }
@SuppressWarnings("unchecked") public <S, T> Instantiator<S, T> createEmptyArgsInstantiator(final Class<S> source, final Class<? extends T> target) throws Exception { InstantiatorKey instantiatorKey = new InstantiatorKey(target, source); Class<? extends Instantiator<?, ?>> instantiatorType = instantiatorCache.get(instantiatorKey); if (instantiatorType == null) { final String className = generateClassNameForInstantiator(instantiatorKey); final byte[] bytes = ConstructorBuilder.createEmptyConstructor(className, source, target); instantiatorType = (Class<? extends Instantiator<?, ?>>) createClass(className, bytes, target.getClassLoader()); instantiatorCache.putIfAbsent(instantiatorKey, instantiatorType); } return (Instantiator<S, T>) instantiatorType.newInstance(); }
private static GetterCall getGetterCall(Class<?> propertyType, Class<? extends Getter> getterClass) { if (TypeHelper.isPrimitive(propertyType)) { Class<?> primitiveGetter = BiInstantiatorBuilder.getPrimitiveGetter(propertyType); if (primitiveGetter == null) { throw new IllegalStateException("No primitive getter for primitive " + propertyType); } Type publicGetterClass = AsmUtils.findClosestPublicTypeExposing(getterClass, primitiveGetter); if (publicGetterClass != null) { return new GetterCall("get" + getPrimitiveMethodSuffix(propertyType), publicGetterClass, true); } } Type publicGetterClass = AsmUtils.findClosestPublicTypeExposing(getterClass, Getter.class); return new GetterCall("get", publicGetterClass, false); }
public static String toWrapperType(Type type) { return toAsmType(toWrapperClass(type)); }
public static byte[] writeClassToFile (final String className, final byte[] bytes) throws IOException { return writeClassToFileInDir(className, bytes, AsmUtils.targetDir); }
public InstantiatorKey(InstantiatorDefinition instantiatorDefinition, Map<Parameter, Getter<? super S, ?>> injections, Class<S> source) { this(getConstructor(instantiatorDefinition), paramAndGetterClass(injections), source); }
private InjectedParam[] createInjectedParameters(String param, Class<?> getterClass) { return new InjectedParam[] {new InjectedParam(param, getterClass)}; }
public static byte[] writeClassToFileInDir(String className, byte[] bytes, File targetDir) throws IOException { if (targetDir != null) { _writeClassToFileInDir(className, bytes, targetDir); } return bytes; }
@SuppressWarnings("unchecked") public <S, T> Instantiator<S, T> createEmptyArgsInstantiator(final Class<S> source, final Class<? extends T> target) throws Exception { InstantiatorKey instantiatorKey = new InstantiatorKey(target, source); Class<? extends Instantiator<?, ?>> instantiatorType = instantiatorCache.get(instantiatorKey); if (instantiatorType == null) { final String className = generateClassNameForInstantiator(instantiatorKey); final byte[] bytes = ConstructorBuilder.createEmptyConstructor(className, source, target); instantiatorType = (Class<? extends Instantiator<?, ?>>) createClass(className, bytes, target.getClassLoader()); instantiatorCache.putIfAbsent(instantiatorKey, instantiatorType); } return (Instantiator<S, T>) instantiatorType.newInstance(); }
public static Type findClosestPublicTypeExposing(Type type, Class<?> expose) { return findTypeInHierarchy(type, new TypeIsPublicAndImplement(expose)); }
@Override public SignatureVisitor visitExceptionType() { return new AppendType(); } });
public String[] getInjectedParams() { if (injectedParams == null) { return new String[0]; } String[] params = new String[injectedParams.length]; for(int i = 0; i < params.length; i++) { params[i] = injectedParams[i].getName(); } return params; } public Class<?> getS1() {
public static byte[] writeClassToFileInDir(String className, byte[] bytes, File targetDir) throws IOException { if (targetDir != null) { _writeClassToFileInDir(className, bytes, targetDir); } return bytes; }
@Override public SignatureVisitor visitExceptionType() { return new AppendType(); } });
public String[] getInjectedParams() { if (injectedParams == null) { return new String[0]; } String[] params = new String[injectedParams.length]; for(int i = 0; i < params.length; i++) { params[i] = injectedParams[i].getName(); } return params; } public Class<?> getSource() {
@Override public SignatureVisitor visitReturnType() { return new AppendType(); }
public String[] getInjectedParams() { if (injectedParams == null) { return new String[0]; } String[] params = new String[injectedParams.length]; for(int i = 0; i < params.length; i++) { params[i] = injectedParams[i].getName(); } return params; } public Class<?> getS1() {
@Override public SignatureVisitor visitReturnType() { return new AppendType(); }