- Revision
- 1409
- Author
- rfscholte
- Date
- 2011-10-12 15:06:16 -0500 (Wed, 12 Oct 2011)
Log Message
Let JavaAnnotation use JavaClass instead of Type
Modified Paths
- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/DefaultAnnotationTransformer.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java
- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaAnnotation.java
Diff
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/DefaultAnnotationTransformer.java (1408 => 1409)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/DefaultAnnotationTransformer.java 2011-10-12 19:42:31 UTC (rev 1408) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/DefaultAnnotationTransformer.java 2011-10-12 20:06:16 UTC (rev 1409) @@ -24,8 +24,8 @@ import java.util.Map; import com.thoughtworks.qdox.model.JavaAnnotatedElement; -import com.thoughtworks.qdox.model.JavaClassParent; -import com.thoughtworks.qdox.model.Type; +import com.thoughtworks.qdox.model.JavaClass; +import com.thoughtworks.qdox.model.JavaType; import com.thoughtworks.qdox.model._expression_.Add; import com.thoughtworks.qdox.model._expression_.And; import com.thoughtworks.qdox.model._expression_.AnnotationValue; @@ -94,320 +94,307 @@ import com.thoughtworks.qdox.parser.structs.AnnoDef; import com.thoughtworks.qdox.parser.structs.TypeDef; -public class DefaultAnnotationTransformer implements AnnotationTransformer<AnnotationValue> { +public class DefaultAnnotationTransformer + implements AnnotationTransformer<AnnotationValue> +{ - private AbstractBaseJavaEntity parent; - - public DefaultAnnotationTransformer(AbstractBaseJavaEntity parent) { - this.parent = (AbstractBaseJavaEntity) parent; - } + private AbstractBaseJavaEntity parent; - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser.structs.AnnoDef) - */ - public DefaultJavaAnnotation transform(AnnoDef annoDef) { - DefaultJavaAnnotation annotation = new DefaultJavaAnnotation(createType(annoDef.getTypeDef(), 0), annoDef.getLineNumber()); - for(Map.Entry<String, ElemValueDef> annoVal : annoDef.getArgs().entrySet()) { - annotation.setProperty(annoVal.getKey(), annoVal.getValue().transform(this)); - } - annotation.setContext((JavaAnnotatedElement) parent); - return annotation; - } + public DefaultAnnotationTransformer( JavaAnnotatedElement parent ) + { + this.parent = (AbstractBaseJavaEntity) parent; + } - private Type createType(TypeDef typeDef, int dimensions) { - if(typeDef == null) { - return null; - } - return TypeAssembler.createUnresolved(typeDef, dimensions, parent.getParentClass() != null ? parent.getParentClass() : parent.getSource() ); + /* + * (non-Javadoc) + * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser.structs.AnnoDef) + */ + public DefaultJavaAnnotation transform( AnnoDef annoDef ) + { + DefaultJavaAnnotation annotation = + new DefaultJavaAnnotation( createType( annoDef.getTypeDef(), 0 ), annoDef.getLineNumber() ); + for ( Map.Entry<String, ElemValueDef> annoVal : annoDef.getArgs().entrySet() ) + { + annotation.setProperty( annoVal.getKey(), annoVal.getValue().transform( this ) ); + } + annotation.setContext( (JavaAnnotatedElement) parent ); + return annotation; } - - public AnnotationValue transform(ElemValueListDef elemValueListDef) { - List<AnnotationValue> parsedList = new LinkedList<AnnotationValue>(); - for(ElemValueDef val : elemValueListDef.getValueList()) { - parsedList.add(val.transform(this)); - } - return new AnnotationValueList(parsedList); + + private JavaClass createType( TypeDef typeDef, int dimensions ) + { + if ( typeDef == null ) + { + return null; + } + return TypeAssembler.createUnresolved( typeDef, + dimensions, + parent.getParentClass() != null ? parent.getParentClass() + : parent.getSource() ); } - - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationAdd) - */ - public AnnotationValue transform(AnnotationAdd annotationAdd) { - AnnotationValue left = annotationAdd.getLeft().transform(this); - AnnotationValue right = annotationAdd.getRight().transform(this); - return new Add(left, right); - } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationAnd) - */ - public AnnotationValue transform(AnnotationAnd annotationAnd) { - AnnotationValue left = annotationAnd.getLeft().transform(this); - AnnotationValue right = annotationAnd.getRight().transform(this); - return new And(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( ElemValueListDef elemValueListDef ) + { + List<AnnotationValue> parsedList = new LinkedList<AnnotationValue>(); + for ( ElemValueDef val : elemValueListDef.getValueList() ) + { + parsedList.add( val.transform( this ) ); + } + return new AnnotationValueList( parsedList ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationDivide) - */ - public AnnotationValue transform(AnnotationDivide annotationDivide) { - AnnotationValue left = annotationDivide.getLeft().transform(this); - AnnotationValue right = annotationDivide.getRight().transform(this); - return new Divide(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationAdd annotationAdd ) + { + AnnotationValue left = annotationAdd.getLeft().transform( this ); + AnnotationValue right = annotationAdd.getRight().transform( this ); + return new Add( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationEquals) - */ - public AnnotationValue transform(AnnotationEquals annotationEquals) { - AnnotationValue left = annotationEquals.getLeft().transform(this); - AnnotationValue right = annotationEquals.getRight().transform(this); - return new Equals(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationAnd annotationAnd ) + { + AnnotationValue left = annotationAnd.getLeft().transform( this ); + AnnotationValue right = annotationAnd.getRight().transform( this ); + return new And( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationExclusiveOr) - */ - public AnnotationValue transform(AnnotationExclusiveOr annotationExclusiveOr) { - AnnotationValue left = annotationExclusiveOr.getLeft().transform(this); - AnnotationValue right = annotationExclusiveOr.getRight().transform(this); - return new ExclusiveOr(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationDivide annotationDivide ) + { + AnnotationValue left = annotationDivide.getLeft().transform( this ); + AnnotationValue right = annotationDivide.getRight().transform( this ); + return new Divide( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationGreaterEquals) - */ - public AnnotationValue transform(AnnotationGreaterEquals annotationGreaterEquals) { - AnnotationValue left = annotationGreaterEquals.getLeft().transform(this); - AnnotationValue right = annotationGreaterEquals.getRight().transform(this); - return new GreaterEquals(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationEquals annotationEquals ) + { + AnnotationValue left = annotationEquals.getLeft().transform( this ); + AnnotationValue right = annotationEquals.getRight().transform( this ); + return new Equals( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationGreaterThan) - */ - public AnnotationValue transform(AnnotationGreaterThan annotationGreaterThan) { - AnnotationValue left = annotationGreaterThan.getLeft().transform(this); - AnnotationValue right = annotationGreaterThan.getRight().transform(this); - return new GreaterThan(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationExclusiveOr annotationExclusiveOr ) + { + AnnotationValue left = annotationExclusiveOr.getLeft().transform( this ); + AnnotationValue right = annotationExclusiveOr.getRight().transform( this ); + return new ExclusiveOr( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationLessEquals) - */ - public AnnotationValue transform(AnnotationLessEquals annotationLessEquals) { - AnnotationValue left = annotationLessEquals.getLeft().transform(this); - AnnotationValue right = annotationLessEquals.getRight().transform(this); - return new LessEquals(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationGreaterEquals annotationGreaterEquals ) + { + AnnotationValue left = annotationGreaterEquals.getLeft().transform( this ); + AnnotationValue right = annotationGreaterEquals.getRight().transform( this ); + return new GreaterEquals( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationLessThan) - */ - public AnnotationValue transform(AnnotationLessThan annotationLessThan) { - AnnotationValue left = annotationLessThan.getLeft().transform(this); - AnnotationValue right = annotationLessThan.getRight().transform(this); - return new LessThan(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationGreaterThan annotationGreaterThan ) + { + AnnotationValue left = annotationGreaterThan.getLeft().transform( this ); + AnnotationValue right = annotationGreaterThan.getRight().transform( this ); + return new GreaterThan( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationLogicalAnd) - */ - public AnnotationValue transform(AnnotationLogicalAnd annotationLogicalAnd) { - AnnotationValue left = annotationLogicalAnd.getLeft().transform(this); - AnnotationValue right = annotationLogicalAnd.getRight().transform(this); - return new LogicalAnd(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationLessEquals annotationLessEquals ) + { + AnnotationValue left = annotationLessEquals.getLeft().transform( this ); + AnnotationValue right = annotationLessEquals.getRight().transform( this ); + return new LessEquals( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationLogicalOr) - */ - public AnnotationValue transform(AnnotationLogicalOr annotationLogicalOr) { - AnnotationValue left = annotationLogicalOr.getLeft().transform(this); - AnnotationValue right = annotationLogicalOr.getRight().transform(this); - return new LogicalOr(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationLessThan annotationLessThan ) + { + AnnotationValue left = annotationLessThan.getLeft().transform( this ); + AnnotationValue right = annotationLessThan.getRight().transform( this ); + return new LessThan( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationMultiply) - */ - public AnnotationValue transform(AnnotationMultiply annotationMultiply) { - AnnotationValue left = annotationMultiply.getLeft().transform(this); - AnnotationValue right = annotationMultiply.getRight().transform(this); - return new Multiply(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationLogicalAnd annotationLogicalAnd ) + { + AnnotationValue left = annotationLogicalAnd.getLeft().transform( this ); + AnnotationValue right = annotationLogicalAnd.getRight().transform( this ); + return new LogicalAnd( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationNotEquals) - */ - public AnnotationValue transform(AnnotationNotEquals annotationNotEquals) { - AnnotationValue left = annotationNotEquals.getLeft().transform(this); - AnnotationValue right = annotationNotEquals.getRight().transform(this); - return new NotEquals(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationLogicalOr annotationLogicalOr ) + { + AnnotationValue left = annotationLogicalOr.getLeft().transform( this ); + AnnotationValue right = annotationLogicalOr.getRight().transform( this ); + return new LogicalOr( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationOr) - */ - public AnnotationValue transform(AnnotationOr annotationOr) { - AnnotationValue left = annotationOr.getLeft().transform(this); - AnnotationValue right = annotationOr.getRight().transform(this); - return new Or(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationMultiply annotationMultiply ) + { + AnnotationValue left = annotationMultiply.getLeft().transform( this ); + AnnotationValue right = annotationMultiply.getRight().transform( this ); + return new Multiply( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationRemainder) - */ - public AnnotationValue transform(AnnotationRemainder annotationRemainder) { - AnnotationValue left = annotationRemainder.getLeft().transform(this); - AnnotationValue right = annotationRemainder.getRight().transform(this); - return new Remainder(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationNotEquals annotationNotEquals ) + { + AnnotationValue left = annotationNotEquals.getLeft().transform( this ); + AnnotationValue right = annotationNotEquals.getRight().transform( this ); + return new NotEquals( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationShiftLeft) - */ - public AnnotationValue transform(AnnotationShiftLeft annotationShiftLeft) { - AnnotationValue left = annotationShiftLeft.getLeft().transform(this); - AnnotationValue right = annotationShiftLeft.getRight().transform(this); - return new ShiftLeft(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationOr annotationOr ) + { + AnnotationValue left = annotationOr.getLeft().transform( this ); + AnnotationValue right = annotationOr.getRight().transform( this ); + return new Or( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationShiftRight) - */ - public AnnotationValue transform(AnnotationShiftRight annotationShiftRight) { - AnnotationValue left = annotationShiftRight.getLeft().transform(this); - AnnotationValue right = annotationShiftRight.getRight().transform(this); - return new ShiftRight(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationRemainder annotationRemainder ) + { + AnnotationValue left = annotationRemainder.getLeft().transform( this ); + AnnotationValue right = annotationRemainder.getRight().transform( this ); + return new Remainder( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationSubtract) - */ - public AnnotationValue transform(AnnotationSubtract annotationSubtract) { - AnnotationValue left = annotationSubtract.getLeft().transform(this); - AnnotationValue right = annotationSubtract.getRight().transform(this); - return new Subtract(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationShiftLeft annotationShiftLeft ) + { + AnnotationValue left = annotationShiftLeft.getLeft().transform( this ); + AnnotationValue right = annotationShiftLeft.getRight().transform( this ); + return new ShiftLeft( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationUnsignedShiftRight) - */ - public AnnotationValue transform(AnnotationUnsignedShiftRight annotationUnsignedShiftRight) { - AnnotationValue left = annotationUnsignedShiftRight.getLeft().transform(this); - AnnotationValue right = annotationUnsignedShiftRight.getRight().transform(this); - return new UnsignedShiftRight(left, right); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationShiftRight annotationShiftRight ) + { + AnnotationValue left = annotationShiftRight.getLeft().transform( this ); + AnnotationValue right = annotationShiftRight.getRight().transform( this ); + return new ShiftRight( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationCast) - */ - public AnnotationValue transform(AnnotationCast annotationCast) { - Type type = createType(annotationCast.getTypeDef(), annotationCast.getTypeDef().getDimensions() ); - AnnotationValue value = annotationCast.getElemDef().transform(this); - return new Cast(type, value); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationSubtract annotationSubtract ) + { + AnnotationValue left = annotationSubtract.getLeft().transform( this ); + AnnotationValue right = annotationSubtract.getRight().transform( this ); + return new Subtract( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationConstant) - */ - public AnnotationValue transform(AnnotationConstant annotationConstant) { - AnnotationValue result; - String image = annotationConstant.getValue(); - Class<?> type = annotationConstant.getType(); - if( type == Integer.class ) - { - result = Constant.newIntegerLiteral( image ); - } - else if ( type == String.class ) - { - result = Constant.newStringLiteral( image ); - } - else if ( type == Boolean.class ) - { - result = Constant.newBooleanLiteral( image ); - } - else if ( type == Character.class ) - { - result = Constant.newCharacterLiteral( image ); - } - else if ( type == Float.class ) { - result = Constant.newFloatingPointLiteral( image ); - } - else { - result = null; //unknown?? - } - return result; - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationUnsignedShiftRight annotationUnsignedShiftRight ) + { + AnnotationValue left = annotationUnsignedShiftRight.getLeft().transform( this ); + AnnotationValue right = annotationUnsignedShiftRight.getRight().transform( this ); + return new UnsignedShiftRight( left, right ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationFieldRef) - */ - public AnnotationValue transform(AnnotationFieldRef annotationFieldRef) { - FieldRef result; - String name = annotationFieldRef.getName(); - result = new FieldRef(name); - result.setContext((JavaAnnotatedElement) parent); - return result; - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationCast annotationCast ) + { + JavaType type = createType( annotationCast.getTypeDef(), annotationCast.getTypeDef().getDimensions() ); + AnnotationValue value = annotationCast.getElemDef().transform( this ); + return new Cast( type, value ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationLogicalNot) - */ - public AnnotationValue transform(AnnotationLogicalNot annotationLogicalNot) { - AnnotationValue value = annotationLogicalNot.getElemValueDef().transform(this); - return new LogicalNot(value); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationConstant annotationConstant ) + { + AnnotationValue result; + String image = annotationConstant.getValue(); + Class<?> type = annotationConstant.getType(); + if ( type == Integer.class ) + { + result = Constant.newIntegerLiteral( image ); + } + else if ( type == String.class ) + { + result = Constant.newStringLiteral( image ); + } + else if ( type == Boolean.class ) + { + result = Constant.newBooleanLiteral( image ); + } + else if ( type == Character.class ) + { + result = Constant.newCharacterLiteral( image ); + } + else if ( type == Float.class ) + { + result = Constant.newFloatingPointLiteral( image ); + } + else + { + result = null; // unknown?? + } + return result; + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationMinusSign) - */ - public AnnotationValue transform(AnnotationMinusSign annotationMinusSign) { - AnnotationValue value = annotationMinusSign.getElemValueDef().transform(this); - return new MinusSign(value); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationFieldRef annotationFieldRef ) + { + FieldRef result; + String name = annotationFieldRef.getName(); + result = new FieldRef( name ); + result.setContext( (JavaAnnotatedElement) parent ); + return result; + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationNot) - */ - public AnnotationValue transform(AnnotationNot annotationNot) { - AnnotationValue value = annotationNot.getElemValueDef().transform(this); - return new Not(value); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationLogicalNot annotationLogicalNot ) + { + AnnotationValue value = annotationLogicalNot.getElemValueDef().transform( this ); + return new LogicalNot( value ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationParenExpression) - */ - public AnnotationValue transform(AnnotationParenExpression annotationParenExpression) { - AnnotationValue value = annotationParenExpression.getElemValueDef().transform(this); - return new ParenExpression(value); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationMinusSign annotationMinusSign ) + { + AnnotationValue value = annotationMinusSign.getElemValueDef().transform( this ); + return new MinusSign( value ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationPlusSign) - */ - public AnnotationValue transform(AnnotationPlusSign annotationPlusSign) { - AnnotationValue value = annotationPlusSign.getElemValueDef().transform(this); - return new PlusSign(value); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationNot annotationNot ) + { + AnnotationValue value = annotationNot.getElemValueDef().transform( this ); + return new Not( value ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationQuery) - */ - public AnnotationValue transform(AnnotationQuery annotationQuery) { - AnnotationValue condition = annotationQuery.getCondition().transform(this); - AnnotationValue trueExpression = annotationQuery.getTrueExpression().transform(this); - AnnotationValue falseExpression = annotationQuery.getFalseExpression().transform(this); - return new Query(condition, trueExpression, falseExpression); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationParenExpression annotationParenExpression ) + { + AnnotationValue value = annotationParenExpression.getElemValueDef().transform( this ); + return new ParenExpression( value ); + } - /* (non-Javadoc) - * @see com.thoughtworks.qdox.builder.AnnotationTransformer#transform(com.thoughtworks.qdox.parser._expression_.AnnotationTypeRef) - */ - public AnnotationValue transform(AnnotationTypeRef annotationTypeRef) { - Type type = createType(annotationTypeRef.getTypeDef(), annotationTypeRef.getTypeDef().getDimensions() ); - return new TypeRef(type); - } + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationPlusSign annotationPlusSign ) + { + AnnotationValue value = annotationPlusSign.getElemValueDef().transform( this ); + return new PlusSign( value ); + } -} + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationQuery annotationQuery ) + { + AnnotationValue condition = annotationQuery.getCondition().transform( this ); + AnnotationValue trueExpression = annotationQuery.getTrueExpression().transform( this ); + AnnotationValue falseExpression = annotationQuery.getFalseExpression().transform( this ); + return new Query( condition, trueExpression, falseExpression ); + } + + /** {@inheritDoc} */ + public AnnotationValue transform( AnnotationTypeRef annotationTypeRef ) + { + JavaType type = createType( annotationTypeRef.getTypeDef(), annotationTypeRef.getTypeDef().getDimensions() ); + return new TypeRef( type ); + } +} \ No newline at end of file
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java (1408 => 1409)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java 2011-10-12 19:42:31 UTC (rev 1408) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/builder/ModelBuilder.java 2011-10-12 20:06:16 UTC (rev 1409) @@ -372,7 +372,7 @@ private void setAnnotations( final AbstractBaseJavaEntity entity ) { if( !currentAnnoDefs.isEmpty() ) { - DefaultAnnotationTransformer transformer = new DefaultAnnotationTransformer(entity); + DefaultAnnotationTransformer transformer = new DefaultAnnotationTransformer( (JavaAnnotatedElement) entity); List<JavaAnnotation> annotations = new LinkedList<JavaAnnotation>(); for( AnnoDef annoDef : currentAnnoDefs) {
Modified: trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaAnnotation.java (1408 => 1409)
--- trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaAnnotation.java 2011-10-12 19:42:31 UTC (rev 1408) +++ trunk/qdox/src/main/java/com/thoughtworks/qdox/model/impl/DefaultJavaAnnotation.java 2011-10-12 20:06:16 UTC (rev 1409) @@ -77,7 +77,7 @@ } } - public DefaultJavaAnnotation( Type type, int line ) + public DefaultJavaAnnotation( JavaClass type, int line ) { this( type, null, null, line ); }
To unsubscribe from this list please visit:
