public static MethodList getMethods( ITypeInfo beanInfo, IType whosaskin ) { if( beanInfo instanceof IRelativeTypeInfo && whosaskin != null ) { return ((IRelativeTypeInfo)beanInfo).getMethods( whosaskin ); } else { return beanInfo.getMethods(); } }
@Override public List<? extends IConstructorInfo> getConstructors() { return _superType.getTypeInfo().getConstructors(); }
public static List<? extends IPropertyInfo> getProperties( ITypeInfo beanInfo, IType classBean ) { if( beanInfo instanceof IRelativeTypeInfo ) { return ((IRelativeTypeInfo)beanInfo).getProperties( classBean ); } else { return beanInfo.getProperties(); } }
private List<? extends IMethodInfo> getMethods(ITypeInfo typeInfo) { if (typeInfo instanceof IRelativeTypeInfo) { return ((IRelativeTypeInfo)typeInfo).getMethods(typeInfo.getOwnersType()); } else { return typeInfo.getMethods(); } }
private String implementIface( IType ifaceType, IType rootType ) { StringBuilder sb = new StringBuilder(); ITypeInfo ti = ifaceType.getTypeInfo(); // Interface properties for( Object o : ti.getProperties() ) { IPropertyInfo pi = (IPropertyInfo)o; genInterfacePropertyDecl( sb, pi, rootType ); } // Interface methods for( Object o : ti.getMethods() ) { IMethodInfo mi = (IMethodInfo)o; genInterfaceMethodDecl( sb, mi, rootType ); } return sb.toString(); }
public static FunctionLiteralType resolve( Class clazz, IType superType, IType referenceType, CharSequence name, IType[] parameters ) { IHasParameterInfos feature; if( name == null ) { feature = referenceType.getTypeInfo().getConstructor( parameters ); } else { feature = referenceType.getTypeInfo().getMethod( name, parameters ); } return new FunctionLiteralType( clazz, superType, feature ); }
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 void resolveRequestTransformAnnotation( IType type, WsiInvocationContextImpl.WebService webservice ) { IAnnotationInfo requestTransformAnnotation = type.getTypeInfo().getAnnotation( _requestTransformType ); if ( requestTransformAnnotation != null ) { Object instance = requestTransformAnnotation.getInstance(); webservice._requestTransform = (Function1) _requestTransformType.getTypeInfo().getProperty( "Transform" ).getAccessor().getValue( instance ); } }
private static IConstructorInfo getConstructor(IType type, IType... argTypes) { return type.getTypeInfo().getConstructor(argTypes); }
public static IPropertyInfo findProperty( IType type, String propertyName ) { ITypeInfo typeInfo = type.getTypeInfo(); return typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getProperty( type, propertyName ) : typeInfo.getProperty( propertyName ); }
webservice = new WsiInvocationContextImpl.WebService(); webservice._backingClass = backingClass; webservice._worker = type.getTypeInfo().getConstructor().getConstructor().newInstance(); resolveRequestTransformAnnotation( type, webservice ); resolveResponseTransformAnnotation( type, webservice ); XmlParseOptions parseOptions; XmlSerializationOptions serializationOptions; IAnnotationInfo parseOptionsAnnotation = type.getTypeInfo().getAnnotation( _wsiParseOptionsAnnotationType ); if ( parseOptionsAnnotation != null ) { Object instance = parseOptionsAnnotation.getInstance(); parseOptions = (XmlParseOptions) _wsiParseOptionsAnnotationType.getTypeInfo().getProperty( "ParseOptions" ).getAccessor().getValue( instance ); if ( parseOptions == null ) { throw new IllegalArgumentException( "null argument to " + _wsiParseOptionsAnnotationType.getName() + " annotation on class " + type.getName() ); additionalSchemaIndexes.add( XmlSchemaResourceTypeLoaderBase.findSchemaForNamespace( defaultModule, "gw.xsd.guidewire.soapheaders" ) ); IAnnotationInfo serializationOptionsAnnotation = type.getTypeInfo().getAnnotation( _wsiSerializationOptionsAnnotationType ); if ( serializationOptionsAnnotation != null ) { Object instance = serializationOptionsAnnotation.getInstance(); serializationOptions = (XmlSerializationOptions) _wsiSerializationOptionsAnnotationType.getTypeInfo().getProperty( "SerializationOptions" ).getAccessor().getValue( instance ); if ( serializationOptions == null ) { throw new IllegalArgumentException( "null argument to " + _wsiSerializationOptionsAnnotationType.getName() + " annotation on class " + type.getName() );
@Override public Object getInstance() { ITypeInfo autocreateTypeInfo = GosuTypes.AUTOCREATE().getTypeInfo(); if ( _concreteType != null && JavaTypes.LIST().isAssignableFrom( _concreteType ) ) { for ( IConstructorInfo constructor : autocreateTypeInfo.getConstructors()) { IParameterInfo[] constructorParams = constructor.getParameters(); if (constructorParams.length > 0 && constructorParams[0].getFeatureType() instanceof IBlockType ) { try { IGosuParser parser = GosuParserFactory.createParser( "\\ -> new java.util.ArrayList()" ); IExpression expr = parser.parseExp( new TypelessScriptPartId( "Xml Schema autocreate block" ) ); Object block = expr.evaluate(); return constructor.getConstructor().newInstance(block); } catch (Exception e) { throw new RuntimeException(e); } } } } return autocreateTypeInfo.getConstructor().getConstructor().newInstance(); }
private void generateSuperCall() IType supertype = ((IFunctionStatement)_sourceOfIssue).getDynamicFunctionSymbol().getDeclaringTypeInfo().getOwnersType().getSupertype(); List<? extends IConstructorInfo> constructors = supertype.getTypeInfo().getConstructors(); if( constructors.size() == 1 )
public IType getOwnersType() { return _container.getOwnersType(); }
public IType getRepeatableContainer() { IType repeatable = JavaTypes.REPEATABLE(); if( getType().getTypeInfo().hasAnnotation( repeatable ) ) { IAnnotationInfo anno = getType().getTypeInfo().getAnnotation( repeatable ); Object type = anno.getFieldValue( "value" ); if( type instanceof String ) { type = TypeSystem.getByFullNameIfValid( (String)type ); } return (IType)type; } return null; } }
private boolean appliesToField( IGosuAnnotation anno ) { IAnnotationInfo annotation = anno.getType().getTypeInfo().getAnnotation( JavaTypes.TARGET() ); if( annotation == null ) { return true; } Object[] values = (Object[])annotation.getFieldValue( "value" ); if( values == null || values.length == 0 ) { return true; } else { for( Object value: values ) { if( value == ElementType.FIELD || value.equals( ElementType.FIELD.name() ) ) { return true; } } } return false; }
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 static String implementIface( IType ifaceType, IType rootType ) { StringBuilder sb = new StringBuilder(); ITypeInfo ti = ifaceType.getTypeInfo(); // Interface properties for( Object o : ti.getProperties() ) { IPropertyInfo pi = (IPropertyInfo)o; genInterfacePropertyDecl( sb, pi, rootType ); } // Interface methods for( Object o : ti.getMethods() ) { IMethodInfo mi = (IMethodInfo)o; genInterfaceMethodDecl( sb, mi, rootType ); } return sb.toString(); }
private void resolveResponseXmlTransformAnnotation( IType type, WsiInvocationContextImpl.WebService webservice ) { IAnnotationInfo xmlTransformAnnotation = type.getTypeInfo().getAnnotation( _responseXmlTransformType ); if ( xmlTransformAnnotation != null ) { Object instance = xmlTransformAnnotation.getInstance(); webservice._responseXmlTransform = (Function1) _responseXmlTransformType.getTypeInfo().getProperty( "Transform" ).getAccessor().getValue( instance ); } }
private static IConstructorInfo getConstructor(IType type, IType... argTypes) { return type.getTypeInfo().getConstructor(argTypes); }