public IMetaType getOwnersType() { return (IMetaType)super.getOwnersType(); }
public boolean isScriptable() { return isVisible( ScriptabilityModifiers.SCRIPTABLE ); }
/** * Returns the list of annotations <b>exactly matching</b> the annotation passed in. If the annotation is a sub type * of the type passed in, this will not return those annotations. * <p/> * This is equivilent to calling getAnnotations().get(type). * * @param type the type to look for */ public List<IAnnotationInfo> getAnnotationsOfType( IType type ) { return ANNOTATION_HELPER.getAnnotationsOfType(type, getAnnotations()); }
private void addAnnotations( List<IAnnotationInfo> annotations, BaseFeatureInfo fi, Map visitedFeatures ) { if( !visitedFeatures.containsKey( fi ) ) { for( IAnnotationInfo annotationInfo : fi.getDeclaredAnnotations() ) { if( fi == this || (ANNOTATION_HELPER.isInherited( annotationInfo.getType() ) && ANNOTATION_HELPER.shouldAddInheritedAnnotation( this, annotations, annotationInfo ))) { if (annotationInfo == null) { throw new NullPointerException("Null annotation found on " + fi + " on " + fi.getOwnersType()); } annotations.add( annotationInfo ); } } visitedFeatures.put( fi, null ); for( BaseFeatureInfo baseFeatureInfo : fi.getSuperAnnotatedElements() ) { addAnnotations( annotations, baseFeatureInfo, visitedFeatures ); } } }
if( this instanceof IConstructorInfo ) featureInfo = type.getTypeInfo().getConstructor( getParamTypes( ((IConstructorInfo)this).getParameters() ) ); featureInfo = type.getTypeInfo().getMethod( getDisplayName(), getParamTypes( ((IMethodInfo)this).getParameters() ) ); featureInfo = type.getTypeInfo().getProperty( getName() );
protected Collection<BaseFeatureInfo> getSuperAnnotatedElements() { List<BaseFeatureInfo> infos = new ArrayList<BaseFeatureInfo>(); addAnnotationSuperElement( infos, getOwnersType().getSupertype() ); if( !(this instanceof IConstructorInfo) ) { IType[] interfaces = getOwnersType().getInterfaces(); if( interfaces != null ) { for( IType anInterface : interfaces ) { if (!TypeSystem.isDeleted(anInterface)) { addAnnotationSuperElement( infos, anInterface ); } } } } return infos; }
public boolean isInternalAPI() { if( _internalAPI == null ) { if( ILanguageLevel.Util.STANDARD_GOSU() || Arrays.stream( notInternalNs ).noneMatch( ns -> getOwnersType() != null && getOwnersType().getNamespace() != null && getOwnersType().getNamespace().startsWith( ns ) ) && Arrays.stream( notInternalNs ).noneMatch( ns -> getOwnersType() != null && getOwnersType().getNamespace() != null && getOwnersType().getNamespace().startsWith( IGosuClass.PROXY_PREFIX + '.' + ns ) ) ) { return _internalAPI = false; } TypeSystem.lock(); try { if( _internalAPI == null ) { _internalAPI = !getAnnotationsOfType(JavaTypes.INTERNAL_API()).isEmpty(); } assert _internalAPI != null; } finally { TypeSystem.unlock(); } } return _internalAPI; }
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 List<IAnnotationInfo> getDeprecatedAnnotation() { if (_deprecated == null) { TypeSystem.lock(); try { if (_deprecated == null) { IType container = _intrType == null ? getContainer().getOwnersType() : _intrType; if( container instanceof ITypeRef ) { _deprecated = getAnnotationsOfType( TypeSystem.getByFullName("gw.lang.Deprecated", container.getTypeLoader().getModule().getExecutionEnvironment().getGlobalModule())); } else { _deprecated = Collections.emptyList(); } } } finally { TypeSystem.unlock(); } } return _deprecated; }
public boolean isDeprecated() { return !getDeprecatedAnnotation().isEmpty(); }
public IType getOwnersType() { if (_intrType != null) { return _intrType; } else { IFeatureInfo container = getContainer(); return container != null ? container.getOwnersType() : null; } }
@Override public boolean hasDeclaredAnnotation( IType type ) { return ANNOTATION_HELPER.hasAnnotation( type, getDeclaredAnnotations() ); }
public List<IAnnotationInfo> getAnnotations() { if( _annotations == null ) { TypeSystem.lock(); try { if( _annotations == null ) { List<IAnnotationInfo> annotations = new ArrayList<IAnnotationInfo>(); addAnnotations( annotations, this, new IdentityHashMap()); _annotations = GosuCollectionUtil.compactAndLockList(annotations); } } finally { TypeSystem.unlock(); } } return _annotations; }
public boolean isInternalAPI() { if( _internalAPI == null ) { TypeSystem.lock(); try { if( _internalAPI == null ) { _internalAPI = !getAnnotationsOfType(JavaTypes.INTERNAL_API()).isEmpty(); } assert _internalAPI != null; } finally { TypeSystem.unlock(); } } return _internalAPI; }
private void addAnnotations( List<IAnnotationInfo> annotations, BaseFeatureInfo fi, Map visitedFeatures ) { if( !visitedFeatures.containsKey( fi ) ) { for( IAnnotationInfo annotationInfo : fi.getDeclaredAnnotations() ) { if( fi == this || (ANNOTATION_HELPER.isInherited( annotationInfo.getType() ) && ANNOTATION_HELPER.shouldAddInheritedAnnotation( this, annotations, annotationInfo ))) { if (annotationInfo == null) { throw new NullPointerException("Null annotation found on " + fi + " on " + fi.getOwnersType()); } annotations.add( annotationInfo ); } } visitedFeatures.put( fi, null ); for( BaseFeatureInfo baseFeatureInfo : fi.getSuperAnnotatedElements() ) { addAnnotations( annotations, baseFeatureInfo, visitedFeatures ); } } }
if( this instanceof IConstructorInfo ) featureInfo = type.getTypeInfo().getConstructor( getParamTypes( ((IConstructorInfo)this).getParameters() ) ); featureInfo = type.getTypeInfo().getMethod( getDisplayName(), getParamTypes( ((IMethodInfo)this).getParameters() ) ); featureInfo = type.getTypeInfo().getProperty( getName() );
protected Collection<BaseFeatureInfo> getSuperAnnotatedElements() { List<BaseFeatureInfo> infos = new ArrayList<BaseFeatureInfo>(); addAnnotationSuperElement( infos, getOwnersType().getSupertype() ); if( !(this instanceof IConstructorInfo) ) { IType[] interfaces = getOwnersType().getInterfaces(); if( interfaces != null ) { for( IType anInterface : interfaces ) { if (!TypeSystem.isDeleted(anInterface)) { addAnnotationSuperElement( infos, anInterface ); } } } } return infos; }
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 List<IAnnotationInfo> getDeprecatedAnnotation() { if (_deprecated == null) { TypeSystem.lock(); try { if (_deprecated == null) { IType container = _intrType == null ? getContainer().getOwnersType() : _intrType; if( container instanceof ITypeRef ) { _deprecated = getAnnotationsOfType( TypeSystem.getByFullName("gw.lang.Deprecated", container.getTypeLoader().getModule().getExecutionEnvironment().getGlobalModule())); } else { _deprecated = Collections.emptyList(); } } } finally { TypeSystem.unlock(); } } return _deprecated; }
public boolean isDeprecated() { return !getDeprecatedAnnotation().isEmpty(); }