public void init( BeanInjectionInfo info ) { introspect( info, leafClass, new TreeMap<>() ); }
BeanLevelInfo leaf = new BeanLevelInfo(); leaf.parent = this; leaf.field = f; if ( ff instanceof GenericArrayType ) { GenericArrayType ffg = (GenericArrayType) ff; t = resolveGenericType( ffg.getGenericComponentType(), genericsInfo ); } else { t = f.getType().getComponentType(); Type listType = ( (ParameterizedType) fieldType ).getActualTypeArguments()[0]; try { t = resolveGenericType( listType, genericsInfo ); } catch ( Throwable ex ) { throw new RuntimeException( "Can't retrieve type from List for " + f, ex ); t = resolveGenericType( f.getGenericType(), genericsInfo ); leaf.introspect( info, t, gi ); BeanLevelInfo leaf = new BeanLevelInfo(); leaf.parent = this; if ( annotationInjectionDeep != null ) { Type getterClass = isGetter( m ); if ( getterClass == null ) { throw new RuntimeException( "Method should be getter: " + m ); Class<?> getter = (Class<?>) resolveGenericType( getterClass, genericsInfo ); if ( getter.isArray() ) {
public BeanInjectionInfo( Class<?> clazz ) { LOG.logDebug( "Collect bean injection info for " + clazz ); try { this.clazz = clazz; clazzAnnotation = clazz.getAnnotation( InjectionSupported.class ); if ( clazzAnnotation == null ) { throw new RuntimeException( "Injection not supported in " + clazz ); } Group gr0 = new Group( "" ); groupsList.add( gr0 ); groupsMap.put( gr0.getName(), gr0 ); for ( String group : clazzAnnotation.groups() ) { Group gr = new Group( group ); groupsList.add( gr ); groupsMap.put( gr.getName(), gr ); } for ( String p : clazzAnnotation.hide() ) { hideProperties.add( p ); } BeanLevelInfo root = new BeanLevelInfo(); root.leafClass = clazz; root.init( this ); properties = Collections.unmodifiableMap( properties ); groupsList = Collections.unmodifiableList( groupsList ); groupsMap = null; } catch ( Throwable ex ) { LOG.logError( "Error bean injection info collection for " + clazz + ": " + ex.getMessage(), ex ); throw ex; } }
protected void addInjectionProperty( Injection metaInj, BeanLevelInfo leaf ) { if ( StringUtils.isBlank( metaInj.name() ) ) { throw new RuntimeException( "Property name shouldn't be blank in the " + clazz ); } String propertyName = calcPropertyName( metaInj, leaf ); if ( properties.containsKey( propertyName ) ) { throw new RuntimeException( "Property '" + propertyName + "' already defined for " + clazz ); } // probably hided if ( hideProperties.contains( propertyName ) ) { return; } Property prop = new Property( propertyName, metaInj.group(), leaf.createCallStack() ); properties.put( prop.name, prop ); Group gr = groupsMap.get( metaInj.group() ); if ( gr == null ) { throw new RuntimeException( "Group '" + metaInj.group() + "' for property '" + metaInj.name() + "' is not defined " + clazz ); } gr.groupProperties.add( prop ); }
introspect( info, clazz.getDeclaredFields(), clazz.getDeclaredMethods(), genericsInfo ); for ( Type intf : clazz.getGenericInterfaces() ) { introspect( info, intf, genericsInfo );