public IncrementalCompilerUsageSearcher( IType type ) { super( new UsageTarget( null, type.getTypeInfo() ), false, false ); _types = new HashSet<>(); _types.add( type ); }
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 ); } }
public static IPropertyInfo findProperty( IType type, String propertyName ) { ITypeInfo typeInfo = type.getTypeInfo(); return typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getProperty( type, propertyName ) : typeInfo.getProperty( propertyName ); }
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 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 void resolveResponseTransformAnnotation( IType type, WsiInvocationContextImpl.WebService webservice ) { IAnnotationInfo responseTransformAnnotation = type.getTypeInfo().getAnnotation( _responseTransformType ); if ( responseTransformAnnotation != null ) { Object instance = responseTransformAnnotation.getInstance(); webservice._responseTransform = (Function1) _responseTransformType.getTypeInfo().getProperty( "Transform" ).getAccessor().getValue( instance ); } }
private static IConstructorInfo findCallableConstructor( IType type, IType[] runtimeTypes ) { ITypeInfo typeInfo = type.getTypeInfo(); List<? extends IConstructorInfo> constructors = typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getConstructors( type ) : typeInfo.getConstructors(); return ITypeInfo.FIND.callableConstructor( constructors, runtimeTypes ); }
/** */ public String getName() { return getOwnersType().getType().getTypeInfo().getName() + " Type"; }
private void resolveInvocationHandlerAnnotation( IType type, WsiInvocationContextImpl.WebService webservice ) { IAnnotationInfo invocationHandlerAnnotationInfo = type.getTypeInfo().getAnnotation( _wsiInvocationHandlerType ); if ( invocationHandlerAnnotationInfo != null ) { Object instance = invocationHandlerAnnotationInfo.getInstance(); webservice._invocationHandler = (DefaultWsiInvocationHandler) _wsiInvocationHandlerType.getTypeInfo().getProperty( "InvocationHandler" ).getAccessor().getValue( instance ); } else { webservice._invocationHandler = new DefaultWsiInvocationHandler(); } }
private boolean hasRetentionPolicy( IAnnotationInfo annotation, RetentionPolicy policy ) { List<IAnnotationInfo> annotationsOfType = annotation.getType().getTypeInfo().getAnnotationsOfType( TypeSystem.get( Retention.class ) ); for( IAnnotationInfo retention : annotationsOfType ) { if( retention != null && retention.getFieldValue( "value" ).equals( policy.name() ) ) { return true; } } return false; }
private IAnnotationInfo makeAutocreateAnnotation(Function0 function) { final IType autocreateType = TypeSystem.getByFullName("gw.lang.Autocreate"); List<? extends IConstructorInfo> constructors = autocreateType.getTypeInfo().getConstructors(); for (IConstructorInfo constructor : constructors) { if (constructor.getParameters().length == 1) { final Object val = constructor.getConstructor().newInstance(function); return new AutoCreateAnnotationInfo(autocreateType, val); } } throw new IllegalStateException("Could not find the block constructor for Autocreate"); }
private static IMethodInfo hasStaticMain( IType type ) { IMethodInfo main = type.getTypeInfo().getMethod( "main", JavaTypes.STRING().getArrayType() ); if( main != null && main.isStatic() && main.getReturnType() == JavaTypes.pVOID() ) { return main; } return null; }
private WsdlFault createWsdlFault( Throwable cause, String message ) { final XmlElement detailElement = (XmlElement) _detailElementType.get().getTypeInfo().getConstructor().getConstructor().newInstance(); StaticallyTypedWsdlFaultImpl fault = new StaticallyTypedWsdlFaultImpl( message, cause, getType() ); fault.setCode( WsdlFault.FaultCode.Sender ); fault.setDetail( detailElement ); return fault; }
private static void maybePushEnumTypes(ISymbolTable symbolTable, IType returnType) { if( !returnType.isEnum() ) { return; } for(IPropertyInfo pi : returnType.getTypeInfo().getProperties() ) { if( pi.isStatic() && pi.isPublic() ) { symbolTable.putSymbol( new Symbol(pi.getName(), pi.getFeatureType(), null) ); } } }
public void setMethodDescriptor(IMethodInfo md) { _md = md; if (md != null) { IType type = JavaTypes.IGOSU_OBJECT(); if (_md.getOwnersType() == IGosuClassInternal.Util.getGosuClassFrom(type)) { _md = type.getTypeInfo().getMethod(_md.getDisplayName(), ((FunctionType) ((IGosuMethodInfo) _md).getDfs().getType()).getParameterTypes()); } } }
private void wrapParameter( XmlElement node, Pair<WsdlOperationParameterInfo, Boolean> paramInfo, Object arg ) { XmlElement parameterElement = (XmlElement) paramInfo.getFirst().getParameterElementType().getTypeInfo().getConstructor().getConstructor().newInstance(); parameterElement = paramInfo.getFirst().wrap( arg, parameterElement ); node.addChild( parameterElement ); }
private Object constructPort( Object arg ) { QName serviceQName = _service.getQName(); QName portQName = _wsdlDefPort.getQName(); IWsdlConfig config = (IWsdlConfig) arg; if ( config == null ) { config = (IWsdlConfig) _wsdlConfigType.get().getTypeInfo().getConstructor().getConstructor().newInstance(); } configure( serviceQName, portQName, config ); return new WsdlPortImpl( getType(), _resourceFile, serviceQName, getWsdl(), portQName, config, _wsdlDefPort ); }
@Override public IMethodInfo getReadMethodInfo() { IJavaClassMethod method = getPropertyDescriptor().getReadMethod(); if( method != null ) { ITypeInfo ti = getOwnersType().getTypeInfo(); return ti instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)ti).getMethod( getOwnersType(), method.getName(), getTypesFromClasses( method.getParameterTypes() ) ) : ti.getMethod( method.getName(), getTypesFromClasses( method.getParameterTypes() ) ); } return null; }
@Override public IMethodInfo getWriteMethodInfo() { IJavaClassMethod method = getPropertyDescriptor().getWriteMethod(); if( method != null ) { ITypeInfo ti = getOwnersType().getTypeInfo(); return ti instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)ti).getMethod( getOwnersType(), method.getName(), getTypesFromClasses( method.getParameterTypes() ) ) : ti.getMethod( method.getName(), getTypesFromClasses( method.getParameterTypes() ) ); } return null; }
private void implementToString() { Identifier thisId = new Identifier(); thisId.setSymbol( new Symbol( Keyword.KW_this.getName(), this, null ), new StandardSymbolTable() ); thisId.setType( this ); BeanMethodCallExpression toStrCall = new BeanMethodCallExpression(); toStrCall.setMethodDescriptor( JavaTypes.IBLOCK().getTypeInfo().getMethod( "toString" ) ); toStrCall.setRootExpression( thisId ); toStrCall.setType( JavaTypes.STRING() ); ReturnStatement returnStmt = new ReturnStatement(); returnStmt.setValue( toStrCall ); }