org.quattor.pan.type
Class AliasType

java.lang.Object
  extended by org.quattor.pan.type.Type
      extended by org.quattor.pan.type.BaseType
          extended by org.quattor.pan.type.AliasType

public class AliasType
extends BaseType

Defines an alias type that references another defined type and can optionally have an additional range defined.

Author:
loomis

Field Summary
 
Fields inherited from class org.quattor.pan.type.Type
source, sourceRange
 
Constructor Summary
AliasType(java.lang.String source, SourceRange sourceRange, java.lang.String identifier, Range range)
          Constructor for AliasType takes the name of the type identifier.
 
Method Summary
 Element findDefault(Context context)
          This method returns the default value for the type or null if no default value exists.
 Element setDefaults(Context context, Element self)
          This method will recursively set the default values on the given element.
 java.lang.String toString()
           
 void validate(Context context, Element self)
          This method will run this type's validation against the given element.
 void verifySubtypesDefined(TypeMap types)
          This method verifies that all of the types referenced from this type are already defined within the given context.
 
Methods inherited from class org.quattor.pan.type.BaseType
getBuiltinTypes
 
Methods inherited from class org.quattor.pan.type.Type
getSource, getSourceRange, validateAsIncludedType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AliasType

public AliasType(java.lang.String source,
                 SourceRange sourceRange,
                 java.lang.String identifier,
                 Range range)
Constructor for AliasType takes the name of the type identifier.

Parameters:
source - String describing the source containing this definition
identifier - name of the referenced type
range - range associated with this type
Method Detail

findDefault

public Element findDefault(Context context)
Description copied from class: Type
This method returns the default value for the type or null if no default value exists. While only FullType objects can directly have a default value, these can be referenced by other types like AliasType and RecordType.

Specified by:
findDefault in class Type
Parameters:
context - the context may be needed by a complex type to look up other type definitions
Returns:
default value or null if one doesn't exist

setDefaults

public Element setDefaults(Context context,
                           Element self)
                    throws EvaluationException
Description copied from class: Type
This method will recursively set the default values on the given element. Note that self cannot be null. If the current element is null, then use the findDefault() method to retrieve the default value, set it, and then call this method to descend into referenced type definitions. This method will return a replacement element if necessary. This may be the case self was protected and default values had to be added. This method will return null if no replacement was necessary. It is the caller's responsibility to make the appropriate update to the parent element.

Specified by:
setDefaults in class Type
Returns:
replacement element or null if no replacement is necessary
Throws:
EvaluationException

validate

public void validate(Context context,
                     Element self)
              throws ValidationException
Description copied from class: Type
This method will run this type's validation against the given element. The method may not modify either argument.

Specified by:
validate in class Type
Parameters:
context - ObjectContext for running the validation
self - Element to validate
Throws:
ValidationException

verifySubtypesDefined

public void verifySubtypesDefined(TypeMap types)
Description copied from class: Type
This method verifies that all of the types referenced from this type are already defined within the given context. If not, an EvaluationException will be thrown.

Specified by:
verifySubtypesDefined in class Type
Parameters:
types - TypeMap to use for looking up referenced types

toString

public java.lang.String toString()
Overrides:
toString in class Type


Copyright © 2011 Quattor. All Rights Reserved.