Package gw.internal.gosu.parser
Class JavaPropertyInfo
- java.lang.Object
-
- gw.lang.reflect.BaseFeatureInfo
-
- gw.internal.gosu.parser.JavaBaseFeatureInfo
-
- gw.internal.gosu.parser.JavaPropertyInfo
-
- All Implemented Interfaces:
IAnnotatedFeatureInfo,IAttributedFeatureInfo,IFeatureInfo,IIntrinsicTypeReference,IMethodBackedPropertyInfo,IPropertyInfo,IJavaBasePropertyInfo,IJavaPropertyInfo
- Direct Known Subclasses:
LengthProperty
public class JavaPropertyInfo extends JavaBaseFeatureInfo implements IJavaPropertyInfo
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classJavaPropertyInfo.PropertyAccessorAdaptor-
Nested classes/interfaces inherited from interface gw.lang.reflect.IAnnotatedFeatureInfo
IAnnotatedFeatureInfo.IAnnotationInfoHelper
-
Nested classes/interfaces inherited from interface gw.lang.reflect.IAttributedFeatureInfo
IAttributedFeatureInfo.MODIFIER
-
-
Field Summary
Fields Modifier and Type Field Description private IPropertyAccessor_accessorprivate LockingLazyVar<IJavaAnnotatedElement>_annotatedElementprivate IType_assignablePropertyTypeWithTypeVarsprivate boolean_bReadableprivate java.lang.Boolean_bStaticprivate IJavaClassMethod_getMethodprivate java.lang.String_nameprivate IJavaPropertyDescriptor_pdprivate IPresentationInfo_presInfoprivate IType_propertyTypeWithTypeVarsprivate IJavaClassField_publicFieldprivate IJavaClassMethod_setMethod-
Fields inherited from interface gw.lang.reflect.IAnnotatedFeatureInfo
ANNOTATION_HELPER
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)JavaPropertyInfo(IFeatureInfo container, IJavaPropertyDescriptor pd)privateJavaPropertyInfo(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType)privateJavaPropertyInfo(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType, IPresentationInfo presInfo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidfindFieldOn(IJavaClassInfo clazz, boolean setter)IPropertyAccessorgetAccessor()protected IJavaAnnotatedElementgetAnnotatedElement()ITypegetAssignableFeatureType()The type this feature can be assigned from.java.util.List<IAnnotationInfo>getDeclaredAnnotations()private IJavaClassInfogetDeclaringClass()java.lang.StringgetDeprecatedReason()java.lang.StringgetDescription()A full description of this feature.java.lang.StringgetDisplayName()Gets the display name of this feature.ITypegetFeatureType()The type of this feature e.g., for a property this is the property's type.ILocationInfogetLocationInfo()IDocRef<IMethodNode>getMethodDocs()java.lang.StringgetName()Gets the programmatic name or identifier of this feature.IPresentationInfogetPresentationInfo()IJavaPropertyDescriptorgetPropertyDescriptor()IJavaClassFieldgetPublicField()IMethodInfogetReadMethodInfo()java.lang.StringgetReturnDescription()java.lang.StringgetShortDescription()private ITypegetTypeFromMethod(IJavaClassMethod m)private IType[]getTypesFromClasses(IJavaClassInfo[] types)IMethodInfogetWriteMethodInfo()private voidinitFlags()booleanisAbstract()protected booleanisDefaultEnumFeature()booleanisDeprecated()booleanisFinal()protected booleanisHiddenViaFeatureDescriptor()booleanisInternal()True if this feature is internal.booleanisPrivate()True if this feature is private.booleanisProtected()True if this feature is protected.booleanisPublic()True if this feature is public.booleanisReadable()booleanisStatic()True if this feature is static, meaning the feature is not specific to a particular instance of the feature's containing type.protected booleanisVisibleViaFeatureDescriptor(IScriptabilityModifier constraint)booleanisWritable()booleanisWritable(IType whosAskin)static IJavaPropertyInfonewInstance(IFeatureInfo container, IJavaPropertyDescriptor pd)static IJavaPropertyInfonewInstance(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType)static IJavaPropertyInfonewInstance(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType, IPresentationInfo presInfo)java.lang.StringtoString()-
Methods inherited from class gw.internal.gosu.parser.JavaBaseFeatureInfo
isHidden, isVisible, makeDeprecated
-
Methods inherited from class gw.lang.reflect.BaseFeatureInfo
getAnnotation, getAnnotations, getAnnotationsOfType, getContainer, getOwnersType, getParamTypes, getSuperAnnotatedElements, hasAnnotation, hasDeclaredAnnotation, isDefaultImpl, isInternalAPI, isReified, isScriptable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.reflect.IAnnotatedFeatureInfo
getAnnotation, getAnnotations, getAnnotationsOfType, hasAnnotation, hasDeclaredAnnotation, isDefaultImpl
-
Methods inherited from interface gw.lang.reflect.IAttributedFeatureInfo
isHidden, isReified, isScriptable, isVisible
-
Methods inherited from interface gw.lang.reflect.IFeatureInfo
getContainer, getOwnersType
-
Methods inherited from interface gw.lang.reflect.IPropertyInfo
isReadable
-
-
-
-
Field Detail
-
_pd
private IJavaPropertyDescriptor _pd
-
_propertyTypeWithTypeVars
private IType _propertyTypeWithTypeVars
-
_assignablePropertyTypeWithTypeVars
private IType _assignablePropertyTypeWithTypeVars
-
_accessor
private IPropertyAccessor _accessor
-
_bStatic
private java.lang.Boolean _bStatic
-
_bReadable
private boolean _bReadable
-
_getMethod
private IJavaClassMethod _getMethod
-
_setMethod
private IJavaClassMethod _setMethod
-
_publicField
private IJavaClassField _publicField
-
_presInfo
private IPresentationInfo _presInfo
-
_name
private java.lang.String _name
-
_annotatedElement
private LockingLazyVar<IJavaAnnotatedElement> _annotatedElement
-
-
Constructor Detail
-
JavaPropertyInfo
JavaPropertyInfo(IFeatureInfo container, IJavaPropertyDescriptor pd)
- Parameters:
container- Typically this will be the containing ITypeInfopd- The property descriptor (from BeanInfo)
-
JavaPropertyInfo
private JavaPropertyInfo(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType)
-
JavaPropertyInfo
private JavaPropertyInfo(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType, IPresentationInfo presInfo)
-
-
Method Detail
-
newInstance
public static IJavaPropertyInfo newInstance(IFeatureInfo container, IJavaPropertyDescriptor pd)
-
newInstance
public static IJavaPropertyInfo newInstance(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType)
-
newInstance
public static IJavaPropertyInfo newInstance(IFeatureInfo container, IJavaPropertyDescriptor pd, IType propertyType, IPresentationInfo presInfo)
-
initFlags
private void initFlags()
-
findFieldOn
private void findFieldOn(IJavaClassInfo clazz, boolean setter)
-
getFeatureType
public IType getFeatureType()
Description copied from interface:IIntrinsicTypeReferenceThe type of this feature e.g., for a property this is the property's type.- Specified by:
getFeatureTypein interfaceIIntrinsicTypeReference
-
getAssignableFeatureType
public IType getAssignableFeatureType()
Description copied from interface:IIntrinsicTypeReferenceThe type this feature can be assigned from. Most of the time this is the same type as getFeatureType(), however it can be different and when it is it should almost always be contravariant with getFeatureType(). A property setter method is the primary use-case. For instance:interface Foo { property Name: CharSequence } class FooImpl implements Foo { var _name: String override property get Name(): String { return _name } override property set Name( cs: CharSequence ) { _name = cs.toString() } }Here FooImpl overrides Foo's Name property with covariance on the getter's return type. This establishes that Name wrt FooImpl is of type String. Yet Foo's setter method must be overridden as-is, a method cannot override another method with covariant parameters. So, in terms of FooImpl's Name property, the setter method is contravariant with String, which again is Name's type wrt of FooImpl. Therefore, FooImpl's Name property should implement getAssignableFeatureType() and return CharSequence.- Specified by:
getAssignableFeatureTypein interfaceIIntrinsicTypeReference
-
getTypeFromMethod
private IType getTypeFromMethod(IJavaClassMethod m)
-
getDeclaringClass
private IJavaClassInfo getDeclaringClass()
-
isReadable
public boolean isReadable()
- Specified by:
isReadablein interfaceIPropertyInfo- Returns:
- true if the property is readable given the visibility constraint passed in, false otherwise.
-
isWritable
public boolean isWritable(IType whosAskin)
- Specified by:
isWritablein interfaceIPropertyInfo- Parameters:
whosAskin- The type querying the property writability. For example, passing in the type the property is on will allow properties that have private access in the setter to be written to. Passing in an unrelated type will only allow properties that are to be written to.- Returns:
- True if the property is writable given the visibility constraint passed in, false otherwise.
-
isWritable
public boolean isWritable()
- Specified by:
isWritablein interfaceIPropertyInfo- Returns:
- True if the property is writable given the visibility constraint passed in, false otherwise.
-
getDeclaredAnnotations
public java.util.List<IAnnotationInfo> getDeclaredAnnotations()
- Specified by:
getDeclaredAnnotationsin interfaceIAnnotatedFeatureInfo- Overrides:
getDeclaredAnnotationsin classJavaBaseFeatureInfo- Returns:
- A map of AnnotationInfo objects by type representing all the annotations associated with this feature, or an empty map if there are no annotations.
-
getMethodDocs
public IDocRef<IMethodNode> getMethodDocs()
- Specified by:
getMethodDocsin interfaceIJavaPropertyInfo
-
getReturnDescription
public java.lang.String getReturnDescription()
- Specified by:
getReturnDescriptionin interfaceIJavaBasePropertyInfo
-
isStatic
public boolean isStatic()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is static, meaning the feature is not specific to a particular instance of the feature's containing type.- Specified by:
isStaticin interfaceIAttributedFeatureInfo
-
isPrivate
public boolean isPrivate()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is private. Private features are only accessible from within the type that owns them.- Specified by:
isPrivatein interfaceIAttributedFeatureInfo- Overrides:
isPrivatein classBaseFeatureInfo
-
isInternal
public boolean isInternal()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is internal. Internal features are accessible from within the type that owns them and from other types in the same namespace.- Specified by:
isInternalin interfaceIAttributedFeatureInfo- Overrides:
isInternalin classBaseFeatureInfo
-
isProtected
public boolean isProtected()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is protected. Protected features are accessible from within the type that owns them and from derived containers.- Specified by:
isProtectedin interfaceIAttributedFeatureInfo- Overrides:
isProtectedin classBaseFeatureInfo
-
isPublic
public boolean isPublic()
Description copied from interface:IAttributedFeatureInfoTrue if this feature is public. Public features are not restricted.- Specified by:
isPublicin interfaceIAttributedFeatureInfo- Overrides:
isPublicin classBaseFeatureInfo
-
isAbstract
public boolean isAbstract()
- Specified by:
isAbstractin interfaceIAttributedFeatureInfo- Overrides:
isAbstractin classBaseFeatureInfo
-
isFinal
public boolean isFinal()
- Specified by:
isFinalin interfaceIAttributedFeatureInfo- Overrides:
isFinalin classBaseFeatureInfo
-
getAnnotatedElement
protected IJavaAnnotatedElement getAnnotatedElement()
- Specified by:
getAnnotatedElementin classJavaBaseFeatureInfo
-
isVisibleViaFeatureDescriptor
protected boolean isVisibleViaFeatureDescriptor(IScriptabilityModifier constraint)
- Specified by:
isVisibleViaFeatureDescriptorin classJavaBaseFeatureInfo
-
isHiddenViaFeatureDescriptor
protected boolean isHiddenViaFeatureDescriptor()
- Specified by:
isHiddenViaFeatureDescriptorin classJavaBaseFeatureInfo
-
isDefaultEnumFeature
protected boolean isDefaultEnumFeature()
- Specified by:
isDefaultEnumFeaturein classJavaBaseFeatureInfo
-
isDeprecated
public boolean isDeprecated()
- Specified by:
isDeprecatedin interfaceIAnnotatedFeatureInfo- Overrides:
isDeprecatedin classBaseFeatureInfo- Returns:
- True if this feature is deprecated.
-
getDeprecatedReason
public java.lang.String getDeprecatedReason()
- Specified by:
getDeprecatedReasonin interfaceIAnnotatedFeatureInfo- Overrides:
getDeprecatedReasonin classBaseFeatureInfo- Returns:
- The deprecation message, or null if the feature is not deprecated.
-
getAccessor
public IPropertyAccessor getAccessor()
- Specified by:
getAccessorin interfaceIPropertyInfo- Returns:
- the PropertyAccessor (for getting and setting) this property.
-
getPresentationInfo
public IPresentationInfo getPresentationInfo()
- Specified by:
getPresentationInfoin interfaceIPropertyInfo
-
getName
public java.lang.String getName()
Description copied from interface:IFeatureInfoGets the programmatic name or identifier of this feature. Note this name should follow Java identifier naming conventions (alpha-num and underscores, but can't start with a digit).- Specified by:
getNamein interfaceIFeatureInfo
-
getDisplayName
public java.lang.String getDisplayName()
Description copied from interface:IFeatureInfoGets the display name of this feature. There is no guarantee this display name is localized.- Specified by:
getDisplayNamein interfaceIFeatureInfo- Overrides:
getDisplayNamein classBaseFeatureInfo
-
getShortDescription
public java.lang.String getShortDescription()
- Specified by:
getShortDescriptionin interfaceIJavaPropertyInfo
-
getDescription
public java.lang.String getDescription()
Description copied from interface:IFeatureInfoA full description of this feature.- Specified by:
getDescriptionin interfaceIFeatureInfo- Overrides:
getDescriptionin classBaseFeatureInfo
-
getReadMethodInfo
public IMethodInfo getReadMethodInfo()
- Specified by:
getReadMethodInfoin interfaceIJavaPropertyInfo- Specified by:
getReadMethodInfoin interfaceIMethodBackedPropertyInfo
-
getPublicField
public IJavaClassField getPublicField()
- Specified by:
getPublicFieldin interfaceIJavaPropertyInfo
-
getWriteMethodInfo
public IMethodInfo getWriteMethodInfo()
- Specified by:
getWriteMethodInfoin interfaceIJavaPropertyInfo- Specified by:
getWriteMethodInfoin interfaceIMethodBackedPropertyInfo
-
getTypesFromClasses
private IType[] getTypesFromClasses(IJavaClassInfo[] types)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classBaseFeatureInfo
-
getPropertyDescriptor
public IJavaPropertyDescriptor getPropertyDescriptor()
- Specified by:
getPropertyDescriptorin interfaceIJavaPropertyInfo
-
getLocationInfo
public ILocationInfo getLocationInfo()
- Specified by:
getLocationInfoin interfaceIFeatureInfo
-
-