public static List<? extends IPropertyInfo> getProperties( ITypeInfo beanInfo, IType classBean ) { if( beanInfo instanceof IRelativeTypeInfo ) { return ((IRelativeTypeInfo)beanInfo).getProperties( classBean ); } else { return beanInfo.getProperties(); } }
public static MethodList getMethods( ITypeInfo beanInfo, IType whosaskin ) { if( beanInfo instanceof IRelativeTypeInfo && whosaskin != null ) { return ((IRelativeTypeInfo)beanInfo).getMethods( whosaskin ); } else { return beanInfo.getMethods(); } }
private IConstructorInfo getSingleConsructor( IType typeToResolveAgainst, ITypeInfo typeInfo ) { List<? extends IConstructorInfo> constructors; if( typeInfo instanceof IRelativeTypeInfo ) { constructors = ((IRelativeTypeInfo)typeInfo).getConstructors( typeToResolveAgainst ); } else { constructors = typeInfo.getConstructors(); } return constructors.size() == 1 ? constructors.get( 0 ) : null; }
protected void mergeMethods(List<IMethodInfo> methods, IType type, boolean replace) { List<? extends IMethodInfo> methodInfos; if (type != null && !TypeSystem.isDeleted(type)) { if (type.getTypeInfo() instanceof IRelativeTypeInfo) { methodInfos = ((IRelativeTypeInfo) type.getTypeInfo()).getMethods( _typeInfo.getOwnersType()); } else { methodInfos = type.getTypeInfo().getMethods(); } for (IMethodInfo methodInfo : methodInfos) { mergeMethod(methods, methodInfo, replace); } } }
constructorInfo = ((IRelativeTypeInfo) typeInfo).getConstructor( typeToResolveAgainst, argTypes ); List<? extends IConstructorInfo> constructors = ((IRelativeTypeInfo)typeInfo).getConstructors( typeToResolveAgainst ); if( constructors != null && constructors.size() == 1 )
((IRelativeTypeInfo) typeInfo).getMethods(type) : typeInfo.getMethods(); ((IRelativeTypeInfo) typeInfo).getConstructors(type) : typeInfo.getConstructors(); for (IConstructorInfo constructor : sort(constructors, CONSTRUCTOR_COMPARATOR)) { ((IRelativeTypeInfo) typeInfo).getProperties(type) : typeInfo.getProperties(); for (IPropertyInfo property : sort(properties, PROPERTY_COMPARATOR)) {
List<? extends IConstructorInfo> constructors; if (typeInfo instanceof IRelativeTypeInfo) { constructors = ((IRelativeTypeInfo) typeInfo).getConstructors(rootType); } else { constructors = typeInfo.getConstructors(); List<? extends IMethodInfo> methods; if (typeInfo instanceof IRelativeTypeInfo) { methods = ((IRelativeTypeInfo) typeInfo).getMethods(rootType); } else { methods = typeInfo.getMethods();
public static IPropertyInfo getProperty( ITypeInfo beanInfo, IType classBean, String strMember ) { IPropertyInfo property; if( beanInfo instanceof IRelativeTypeInfo) { property = ((IRelativeTypeInfo)beanInfo).getProperty( classBean, strMember ); } else { property = beanInfo.getProperty( strMember ); } return property; } }
protected void mergeProperties(PropertyNameMap<T> props, IType type, boolean replace) { if( type != null ) { List<? extends IPropertyInfo> propertyInfos; if (type.getTypeInfo() instanceof IRelativeTypeInfo) { propertyInfos = ((IRelativeTypeInfo) type.getTypeInfo()).getProperties( _typeInfo.getOwnersType()); } else { propertyInfos = type.getTypeInfo().getProperties(); } for (IPropertyInfo propertyInfo : propertyInfos) { IType ownersType = propertyInfo.getOwnersType(); if ( _supertypeToCopyPropertiesFrom == null || ownersType.isAssignableFrom( _supertypeToCopyPropertiesFrom ) || ownersType instanceof IGosuEnhancement ) { mergeProperty( props, propertyInfo, replace ); } } } }
static IMethodInfo getMethodInfo( IType rootType, String funcName, IType[] params ) { ITypeInfo typeInfo = rootType.getTypeInfo(); if( typeInfo instanceof IRelativeTypeInfo ) { return ((IRelativeTypeInfo)typeInfo).getMethod( rootType, funcName, params ); } else { return typeInfo.getMethod( funcName, params ); } }
private Object getFromJavaType() { IJavaType javaType = _owner.getJavaType(); IRelativeTypeInfo typeInfo = (IRelativeTypeInfo)javaType.getTypeInfo(); if( _container instanceof IPropertyInfo ) { return typeInfo.getProperty( javaType, _container.getDisplayName() ).getAnnotation( getType() ).getInstance(); } return typeInfo.getMethod( javaType, _container.getDisplayName(), BaseFeatureInfo.getParamTypes( ((IMethodInfo)_container).getParameters() ) ).getAnnotation( getType() ).getInstance(); }
public ConstructorReference( IType rootType, IType[] params, Object[] boundValues ) { ITypeInfo typeInfo = rootType.getTypeInfo(); if( typeInfo instanceof IRelativeTypeInfo ) { _ci = ((IRelativeTypeInfo)typeInfo).getConstructor( rootType, params ); } else { _ci = typeInfo.getConstructor( params ); } _boundValues = boundValues; }
for( IConstructorInfo constructorInfo : gosuClass.getTypeInfo().getDeclaredConstructors() ) for( IMethodInfo methodInfo : gosuClass.getTypeInfo().getDeclaredMethods() ) for( IPropertyInfo propertyInfo : gosuClass.getTypeInfo().getDeclaredProperties() )
if( actualDeclaringType != null ) List<? extends IConstructorInfo> genDeclaredConstructors = ((IRelativeTypeInfo)declaringType.getTypeInfo()).getDeclaredConstructors(); for( int i = 0; i < genDeclaredConstructors.size(); i++ ) if( new ConstructorType( rawCtor ).equals( ctorType ) ) List<? extends IConstructorInfo> paramDeclaredConstructors = ((IRelativeTypeInfo)actualDeclaringType.getTypeInfo()).getDeclaredConstructors(); for( IConstructorInfo csr: paramDeclaredConstructors ) List<? extends IConstructorInfo> constructors = ((IRelativeTypeInfo)declaringType.getTypeInfo()).getConstructors( getGosuClass() ); int index = constructors.indexOf( ci ); if( index >= 0 ) List<? extends IConstructorInfo> actualTypeCtors = ((IRelativeTypeInfo)actualType.getTypeInfo()).getConstructors( getGosuClass() ); ci = actualTypeCtors.get( index ); ctorType = new ConstructorType( ci );
if (_propertiesInitialized.get(module) != InitState.Initialized) { if (_propertiesInitialized.get(module) == InitState.Initializing) { throw new IllegalStateException("Properties for " + _typeInfo.getOwnersType() + " are cyclic."); for (IType type : _typeInfo.getOwnersType().getInterfaces()) { mergeProperties(privateProps, convertType(type), false); IType supertype = _typeInfo.getOwnersType().getSupertype(); if ( supertype != null ) { mergeProperties( privateProps, convertType( supertype ), true ); List<IPropertyInfo> declaredProperties = (List<IPropertyInfo>) _typeInfo.getDeclaredProperties(); for (IPropertyInfo property : declaredProperties) { mergeProperty(privateProps, property, true); throw GosuExceptionUtil.forceThrow( ex, _typeInfo.getOwnersType().getName() ); } finally { TypeSystem.unlock();
List<? extends IMethodInfo> declaredMethods = ((IRelativeTypeInfo)type.getTypeInfo()).getDeclaredMethods(); for( IMethodInfo mi : declaredMethods ) List<? extends IPropertyInfo> declaredProperties = ((IRelativeTypeInfo)type.getTypeInfo()).getDeclaredProperties(); for( IPropertyInfo mi : declaredProperties )
if (_ctorsInitialized != InitState.Initialized) { if (_ctorsInitialized == InitState.Initializing) { throw new IllegalStateException("Constructors for " + _typeInfo.getOwnersType() + " are cyclic."); List<IConstructorInfo> privateConstructors = new ArrayList<IConstructorInfo>( _typeInfo.getDeclaredConstructors()); ((ArrayList) privateConstructors).trimToSize(); privateConstructors = Collections.unmodifiableList(privateConstructors); throw GosuExceptionUtil.forceThrow( ex, _typeInfo.getOwnersType().getName() ); } finally { TypeSystem.unlock();
if (_methodsInitialized.get(module) != InitState.Initialized) { if (_methodsInitialized.get(module) == InitState.Initializing) { throw new IllegalStateException("Methods for " + _typeInfo.getOwnersType() + " are cyclic."); throw new IllegalStateException( "Null TypeInfo" ); if( _typeInfo.getOwnersType() == null ) { throw new IllegalStateException( "null owner" ); if( _typeInfo.getOwnersType().getInterfaces() == null ) { throw new IllegalStateException( "null interfaces for " + _typeInfo.getOwnersType().getName() ); for (IType type : _typeInfo.getOwnersType().getInterfaces()) { mergeMethods(privateMethods, convertType(type), false); if ( _typeInfo.getOwnersType().getSupertype() != null) { mergeMethods(privateMethods, convertType( _typeInfo.getOwnersType().getSupertype()), true); List<? extends IMethodInfo> declaredMethods = _typeInfo.getDeclaredMethods(); for (IMethodInfo methodInfo : declaredMethods) { mergeMethod(privateMethods, methodInfo, true); throw GosuExceptionUtil.forceThrow( ex, _typeInfo.getOwnersType().getName() ); } finally { TypeSystem.unlock();
private static String[] getNamesForJavaAnnotation( IType type ) { IRelativeTypeInfo rTypeInfo = (IRelativeTypeInfo)type.getTypeInfo(); List<IMethodInfo> methodInfos = new ArrayList<IMethodInfo>( rTypeInfo.getDeclaredMethods() ); Collections.sort( methodInfos, new Comparator<IMethodInfo>() { @Override public int compare( IMethodInfo o1, IMethodInfo o2 ) { return o1.getName().compareTo( o2.getName() ); } } ); String[] strings = new String[methodInfos.size()]; for( int i = 0; i < methodInfos.size(); i++ ) { IMethodInfo methodInfo = methodInfos.get( i ); strings[i] = methodInfo.getDisplayName(); } return strings; }
protected Map<String,IPropertyInfo> getProperties(IType type) { Map<String, IPropertyInfo> rtn = new TreeMap<String,IPropertyInfo>(); ITypeInfo typeInfo = type.getTypeInfo(); if (typeInfo instanceof IRelativeTypeInfo) { IRelativeTypeInfo pogoTI = ((IRelativeTypeInfo) typeInfo); for (IPropertyInfo property : pogoTI.getDeclaredProperties()) { if (property.isPublic() && property.isWritable() && property.isReadable()) { rtn.put(property.getName(), property); } } } return rtn; }