Skip to content

Commit

Permalink
Added javadoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jan 13, 2016
1 parent ff627ac commit d0a8c46
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 5 deletions.
Expand Up @@ -532,6 +532,9 @@ public String toString() {
}
}

/**
* A visitor that strips all type annotations of all types.
*/
enum AnnotationStripper implements Visitor<Generic> {

/**
Expand Down Expand Up @@ -579,10 +582,21 @@ public String toString() {
return "TypeDescription.Generic.Visitor.AnnotationStripper." + name();
}

/**
* Representation of a type variable without annotations.
*/
protected static class NonAnnotatedTypeVariable extends OfTypeVariable {

/**
* The represented type variable.
*/
private final Generic typeVariable;

/**
* Creates a new non-annotated type variable.
*
* @param typeVariable The represented type variable.
*/
protected NonAnnotatedTypeVariable(Generic typeVariable) {
this.typeVariable = typeVariable;
}
Expand Down Expand Up @@ -5258,7 +5272,7 @@ public static class OfMethodParameter extends LazyProjection.OfAnnotatedElement
*
* @param method The method of which a parameter type is represented.
* @param index The parameter's index.
* @param erasure The erasures of the method's parameter types.
* @param erasure The erasures of the method's parameter types.
*/
public OfMethodParameter(Method method, int index, Class<?>[] erasure) {
this.method = method;
Expand Down
Expand Up @@ -84,20 +84,42 @@ public String toString() {
}

/**
* A type attribute appender that writes all annotations of the instrumented types but those that are explicitly excluded.
* A type attribute appender that writes all annotations of the instrumented but excludes annotations up to
* a given index.
*/
public static class Differentiating implements TypeAttributeAppender {

/**
* The index of the first annotations that should be directly written onto the type.
*/
private final int annotationIndex;

/**
* The index of the first type variable for which type annotations should be directly written onto the type.
*/
private final int typeVariableIndex;

/**
* The index of the first interface type for which type annotations should be directly written onto the type.
*/
private final int interfaceTypeIndex;

public Differentiating(TypeDescription instrumentedType) {
this(instrumentedType.getDeclaredAnnotations().size(), instrumentedType.getTypeVariables().size(), instrumentedType.getInterfaces().size());
/**
* Creates a new differentiating type attribute appender.
*
* @param typeDescription The type for which to resolve all exclusion indices.
*/
public Differentiating(TypeDescription typeDescription) {
this(typeDescription.getDeclaredAnnotations().size(), typeDescription.getTypeVariables().size(), typeDescription.getInterfaces().size());
}

/**
* Creates a new differentiating type attribute appender.
*
* @param annotationIndex The index of the first annotations that should be directly written onto the type.
* @param typeVariableIndex The index of the first interface type for which type annotations should be directly written onto the type.
* @param interfaceTypeIndex The index of the first interface type for which type annotations should be directly written onto the type.
*/
protected Differentiating(int annotationIndex, int typeVariableIndex, int interfaceTypeIndex) {
this.annotationIndex = annotationIndex;
this.typeVariableIndex = typeVariableIndex;
Expand Down
@@ -0,0 +1,15 @@
package net.bytebuddy.description.type;

import net.bytebuddy.test.utility.ObjectPropertyAssertion;
import org.junit.Test;

public class TypeDescriptionGenericVisitorAnnotationStripperTest {

// TODO:


@Test
public void testObjectProperties() throws Exception {
ObjectPropertyAssertion.of(TypeDescription.Generic.Visitor.AnnotationStripper.class).apply();
}
}
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -41,7 +41,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<code.level>1.6/code.level>
<code.level>1.6</code.level>
<pitest.target>net.bytebuddy</pitest.target>
<cobertura.exclude.benchmark.generated>net/bytebuddy/benchmark/generated/**/*.class</cobertura.exclude.benchmark.generated>
<cobertura.exclude.benchmark.jmh>org/openjdk/jmh/infra/generated/**/*.class</cobertura.exclude.benchmark.jmh>
Expand Down

0 comments on commit d0a8c46

Please sign in to comment.