protected Collection<TestMetadata> createMetadata(List<IAnnotationInfo> annotationInfos) { Map<Class<? extends Annotation>, TestMetadata> map = new HashMap<Class<? extends Annotation>, TestMetadata>(); for (IAnnotationInfo ai : annotationInfos) { if (isMetaAnnotationInfo(ai)) { Annotation a = (Annotation) ai.getInstance(); map.put(a.annotationType(), new TestMetadata(a)); } } if (map.containsKey(KnownBreak.class)) { for (IAnnotationInfo ai : annotationInfos) { if (isKnownBreakQualifier(ai)) { Annotation a = (Annotation) ai.getInstance(); Predicate<? super Annotation> qualifierPredicate; try { qualifierPredicate = a.annotationType().getAnnotation(KnownBreakQualifier.class).value().newInstance(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } if (!qualifierPredicate.evaluate(a)) { map.remove(KnownBreak.class); break; } } } } return map.values(); }
public List<IExceptionInfo> getExceptions() { if (_exceptions == null) { _exceptions = Collections.emptyList(); List<IAnnotationInfo> annotations = getAnnotationsOfType(TypeSystem.getByFullName("gw.lang.Throws")); if (annotations != null) { for (IAnnotationInfo annotation : annotations) { Throws throwsInstance = (Throws) annotation.getInstance(); if (throwsInstance != null) { if( _exceptions.isEmpty() ) { _exceptions = new ArrayList<IExceptionInfo>( 2 ); } _exceptions.add(new GosuExceptionInfo(this, throwsInstance.ExceptionType().getName(), throwsInstance.ExceptionDescription())); } } } } return _exceptions; }
public static Object eval( IAnnotationInfo ai ) { if( ai instanceof GosuAnnotationInfo ) { GosuAnnotationInfo info = (GosuAnnotationInfo) ai; return evalGosuAnnotation(info.getNewExpressionAsString(), info.getOwnersType()); } else { return ai.getInstance(); } }
static private Set<TestMetadata> getTestClassMetadata(TestClass test) { Set<TestMetadata> set = new HashSet<TestMetadata>(); for (IAnnotationInfo ai : test.getType().getTypeInfo().getAnnotations()) { if (isMetaAnnotationInfo(ai)) { set.add(new TestMetadata((Annotation) ai.getInstance())); } } return set; }
public List<IExceptionInfo> getExceptions() { if (_exceptions == null) { _exceptions = Collections.emptyList(); List<IAnnotationInfo> annotations = getAnnotationsOfType(TypeSystem.getByFullName("gw.lang.Throws")); if (annotations != null) { for (IAnnotationInfo annotation : annotations) { Throws throwsInstance = (Throws) annotation.getInstance(); if (throwsInstance != null) { if( _exceptions.isEmpty() ) { _exceptions = new ArrayList<IExceptionInfo>( 2 ); } _exceptions.add(new GosuExceptionInfo(this, throwsInstance.getExceptionType().getName(), throwsInstance.getExceptionDescription())); } } } } return _exceptions; }
value = ((IAnnotationInfo)value).getInstance();
static private Set<TestMetadata> getTestMethodMetadata(TestClass test, String method) { Set<TestMetadata> set = new HashSet<TestMetadata>(); IMethodInfo testMethod = test.getType().getTypeInfo().getMethod(method); if(testMethod == null) { throw new IllegalStateException( "Method not found: " + test.getName() + "." + method); } for (IAnnotationInfo ai : testMethod.getAnnotations()) { if (isMetaAnnotationInfo(ai)) { set.add(new TestMetadata((Annotation) ai.getInstance())); } } return set; }
private static String getShortName(IPropertyInfo propertyInfo) { String shortName = makeCmdLineOptionName( propertyInfo ); if (propertyInfo.hasAnnotation(TypeSystem.get(ShortName.class))) { IAnnotationInfo annotation = propertyInfo.getAnnotationsOfType( TypeSystem.get( ShortName.class ) ).get( 0 ); ShortName value = (ShortName)annotation.getInstance(); shortName = value.name(); } return shortName; }
private static String getLongName(IPropertyInfo propertyInfo) { String shortName = makeCmdLineOptionName( propertyInfo ); if (propertyInfo.hasAnnotation(TypeSystem.get(LongName.class))) { IAnnotationInfo annotation = propertyInfo.getAnnotationsOfType( TypeSystem.get( LongName.class ) ).get( 0 ); LongName value = (LongName)annotation.getInstance(); shortName = value.name(); } return shortName; }
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 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(); }
private void resolveRequestXmlTransformAnnotation( IType type, WsiInvocationContextImpl.WebService webservice ) { IAnnotationInfo xmlTransformAnnotation = type.getTypeInfo().getAnnotation( _requestXmlTransformType ); if ( xmlTransformAnnotation != null ) { Object instance = xmlTransformAnnotation.getInstance(); webservice._requestXmlTransform = (Function1) _requestXmlTransformType.getTypeInfo().getProperty( "Transform" ).getAccessor().getValue( instance ); } }
/** this will create the target namespace for this type * * @param type to create a target namespace for * @return the uri for this type */ public static String createTargetNamespace( IType type ) { @SuppressWarnings( {"deprecation"} ) IWsiWebService clsAnnot = (IWsiWebService)type.getTypeInfo().getAnnotationsOfType( WsiUtilities.WSI_WEB_SERVICE_ANNOTATION_TYPE.get() ).get( 0 ).getInstance(); if ( clsAnnot.getTargetNamespace() == null ) { return getInstance().getService( IMarshaller.class ).createTargetNamespace( null, type ); } else { return clsAnnot.getTargetNamespace(); } }
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(); }
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(); } }
Autocreate o = (Autocreate)annotation.getInstance(); Class<? extends Callable> block = o.value(); if( block == null || block.isInterface() )
IDepends dependsAnnotationValue = (IDepends) dependsAnnotation.getInstance(); for ( String dependencyTarget : dependsAnnotationValue.dependencies() ) { target.addDependency( camelCaseToHyphenated(dependencyTarget) );
IAutocreate o = (IAutocreate)annotation.getInstance(); IBlock block = (IBlock)o.getBlock(); if( block == null )