private ArrayList < AptPropertySet > initPropertySets ( ) { ArrayList < AptPropertySet > propSets = new ArrayList < AptPropertySet > ( ) ; if ( _intfDecl == null ) return propSets ; // TODO: enforce presence of prefixes when multiple property sets w/ the same // property name exist // // Add the intrinsic/base property set // TypeDeclaration basePropsDecl = _ap . getAnnotationProcessorEnvironment ( ) . getTypeDeclaration ( "org.apache.beehive.controls.api.properties.BaseProperties" ) ; if ( basePropsDecl != null ) { propSets . add ( new AptPropertySet ( null , basePropsDecl , _ap ) ) ; } // // Add external property sets // ExternalPropertySets extPropsAnnotation = _intfDecl . getAnnotation ( ExternalPropertySets . class ) ; if ( extPropsAnnotation != null ) { if ( isExtension ( ) ) { _ap . printError ( _intfDecl , "extpropertyset.illegal.usage" ) ; } try { Class [ ] extProps = extPropsAnnotation . value ( ) ; } catch ( MirroredTypesException mte ) { Collection < String > extProps = mte . getQualifiedNames ( ) ; for ( String extPropName : extProps ) { TypeDeclaration extPropDecl = _ap . getAnnotationProcessorEnvironment ( ) . getTypeDeclaration ( extPropName ) ; if ( extPropDecl != null ) { AptPropertySet extPropSet = new AptPropertySet ( null , extPropDecl , _ap ) ; propSets . add ( extPropSet ) ; } else { _ap . printError ( _intfDecl , "extpropertyset.type.not.found" , extPropName ) ; } } } } // // Add nested property sets // if ( _intfDecl . getNestedTypes ( ) == null ) return propSets ; for ( TypeDeclaration innerDecl : _intfDecl . getNestedTypes ( ) ) { boolean fError = false ; if ( innerDecl . getAnnotation ( PropertySet . class ) != null ) { if ( ! ( innerDecl instanceof AnnotationTypeDeclaration ) ) { _ap . printError ( innerDecl , "propertyset.not.annotation.type" ) ; fError = true ; } Retention ret = innerDecl . getAnnotation ( Retention . class ) ; if ( ret == null || ret . value ( ) != RetentionPolicy . RUNTIME ) { _ap . printError ( innerDecl , "propertyset.missing.retention" ) ; fError = true ; } if ( isExtension ( ) ) { _ap . printError ( innerDecl , "propertyset.illegal.usage.2" ) ; fError = true ; } if ( ! fError ) propSets . add ( new AptPropertySet ( this , ( AnnotationTypeDeclaration ) innerDecl , _ap ) ) ; } } // // Detect the presence of locally declared bound or constrained properties // Enforce property name (including prefix) uniqueness across all propertysets on this interface. // Set < String > propertyNames = new HashSet < String > ( ) ; for ( AptPropertySet propSet : propSets ) { for ( AptProperty prop : propSet . getProperties ( ) ) { if ( prop . isBound ( ) ) _hasBoundProperties = true ; if ( prop . isConstrained ( ) ) _hasConstrainedProperties = true ; String propName = prop . getAccessorName ( ) ; if ( propertyNames . contains ( propName ) ) { _ap . printError ( _intfDecl , "propertyset.duplicate.property.names" , propName , propSet . getShortName ( ) ) ; } else { propertyNames . add ( propName ) ; } } } return propSets ; }
Initializes the list of PropertySets declared or referenced by this AptControlInterface