Skip to content

Commit

Permalink
Renamed "declared form" to "defined shape" in order to avoid confusio…
Browse files Browse the repository at this point in the history
…n with Java's declaration terminology.
  • Loading branch information
Rafael Winterhalter committed Jul 23, 2015
1 parent 1642955 commit adb17e0
Show file tree
Hide file tree
Showing 75 changed files with 313 additions and 333 deletions.
Expand Up @@ -49,17 +49,17 @@ public interface FieldDescription extends ByteCodeElement, NamedElement.WithGene
*/
Token asToken(ElementMatcher<? super TypeDescription> targetTypeMatcher);

InDeclaredForm asDeclared();
InDefinedShape asDefined();

interface InDeclaredForm extends FieldDescription {
interface InDefinedShape extends FieldDescription {

@Override
TypeDescription getDeclaringType();

abstract class AbstractBase extends FieldDescription.AbstractBase implements InDeclaredForm {
abstract class AbstractBase extends FieldDescription.AbstractBase implements InDefinedShape {

@Override
public InDeclaredForm asDeclared() {
public InDefinedShape asDefined() {
return this;
}
}
Expand Down Expand Up @@ -158,7 +158,7 @@ public String toString() {
/**
* An implementation of a field description for a loaded field.
*/
class ForLoadedField extends InDeclaredForm.AbstractBase {
class ForLoadedField extends InDefinedShape.AbstractBase {

/**
* The represented loaded field.
Expand Down Expand Up @@ -209,7 +209,7 @@ public boolean isSynthetic() {
* A latent field description describes a field that is not attached to a declaring
* {@link TypeDescription}.
*/
class Latent extends InDeclaredForm.AbstractBase {
class Latent extends InDefinedShape.AbstractBase {

/**
* The type for which this field is defined.
Expand Down Expand Up @@ -358,8 +358,8 @@ public String getName() {
}

@Override
public InDeclaredForm asDeclared() {
return fieldDescription.asDeclared();
public InDefinedShape asDefined() {
return fieldDescription.asDefined();
}
}

Expand Down
@@ -1,7 +1,6 @@
package net.bytebuddy.description.field;

import net.bytebuddy.description.ByteCodeElement;
import net.bytebuddy.description.method.ParameterDescription;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.description.type.generic.GenericTypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
Expand Down Expand Up @@ -36,7 +35,7 @@ public interface FieldList<T extends FieldDescription> extends FilterableList<T,
*/
ByteCodeElement.Token.TokenList<FieldDescription.Token> asTokenList(ElementMatcher<? super TypeDescription> targetTypeMatcher);

FieldList<FieldDescription.InDeclaredForm> asDeclared();
FieldList<FieldDescription.InDefinedShape> asDefined();

/**
* An abstract base implementation of a {@link FieldList}.
Expand All @@ -58,12 +57,12 @@ public ByteCodeElement.Token.TokenList<FieldDescription.Token> asTokenList(Eleme
}

@Override
public FieldList<FieldDescription.InDeclaredForm> asDeclared() {
List<FieldDescription.InDeclaredForm> declaredForms = new ArrayList<FieldDescription.InDeclaredForm>(size());
public FieldList<FieldDescription.InDefinedShape> asDefined() {
List<FieldDescription.InDefinedShape> declaredForms = new ArrayList<FieldDescription.InDefinedShape>(size());
for (FieldDescription fieldDescription : this) {
declaredForms.add(fieldDescription.asDeclared());
declaredForms.add(fieldDescription.asDefined());
}
return new Explicit<FieldDescription.InDeclaredForm>(declaredForms);
return new Explicit<FieldDescription.InDefinedShape>(declaredForms);
}

@Override
Expand All @@ -75,7 +74,7 @@ protected FieldList<S> wrap(List<S> values) {
/**
* An implementation of a field list for an array of loaded fields.
*/
class ForLoadedField extends AbstractBase<FieldDescription.InDeclaredForm> {
class ForLoadedField extends AbstractBase<FieldDescription.InDefinedShape> {

/**
* The loaded fields this field list represents.
Expand All @@ -101,7 +100,7 @@ public ForLoadedField(List<? extends Field> fields) {
}

@Override
public FieldDescription.InDeclaredForm get(int index) {
public FieldDescription.InDefinedShape get(int index) {
return new FieldDescription.ForLoadedField(fields.get(index));
}

Expand Down Expand Up @@ -144,7 +143,7 @@ public int size() {
/**
* A list of field descriptions for a list of detached tokens. For the returned fields, each token is attached to its field representation.
*/
class ForTokens extends AbstractBase<FieldDescription.InDeclaredForm> {
class ForTokens extends AbstractBase<FieldDescription.InDefinedShape> {

/**
* The declaring type of the represented fields.
Expand All @@ -168,7 +167,7 @@ public ForTokens(TypeDescription declaringType, List<? extends FieldDescription.
}

@Override
public FieldDescription.InDeclaredForm get(int index) {
public FieldDescription.InDefinedShape get(int index) {
return new FieldDescription.Latent(declaringType, tokens.get(index));
}

Expand Down Expand Up @@ -227,8 +226,8 @@ public int size() {
/**
* An implementation of an empty field list.
*/
class Empty extends FilterableList.Empty<FieldDescription.InDeclaredForm, FieldList<FieldDescription.InDeclaredForm>>
implements FieldList<FieldDescription.InDeclaredForm> {
class Empty extends FilterableList.Empty<FieldDescription.InDefinedShape, FieldList<FieldDescription.InDefinedShape>>
implements FieldList<FieldDescription.InDefinedShape> {

@Override
public ByteCodeElement.Token.TokenList<FieldDescription.Token> asTokenList() {
Expand All @@ -241,7 +240,7 @@ public ByteCodeElement.Token.TokenList<FieldDescription.Token> asTokenList(Eleme
}

@Override
public FieldList<FieldDescription.InDeclaredForm> asDeclared() {
public FieldList<FieldDescription.InDefinedShape> asDefined() {
return this;
}
}
Expand Down
Expand Up @@ -242,20 +242,20 @@ public interface MethodDescription extends TypeVariableSource, NamedElement.With
*/
Token asToken(ElementMatcher<? super TypeDescription> targetTypeMatcher);

InDeclaredForm asDeclared();
inDefinedShape asDefined();

interface InDeclaredForm extends MethodDescription {
interface inDefinedShape extends MethodDescription {

@Override
TypeDescription getDeclaringType();

@Override
ParameterList<ParameterDescription.InDeclaredForm> getParameters();
ParameterList<ParameterDescription.InDefinedShape> getParameters();

abstract class AbstractBase extends MethodDescription.AbstractBase implements InDeclaredForm {
abstract class AbstractBase extends MethodDescription.AbstractBase implements inDefinedShape {

@Override
public InDeclaredForm asDeclared() {
public inDefinedShape asDefined() {
return this;
}
}
Expand Down Expand Up @@ -669,7 +669,7 @@ public String toString() {
/**
* An implementation of a method description for a loaded constructor.
*/
class ForLoadedConstructor extends InDeclaredForm.AbstractBase {
class ForLoadedConstructor extends inDefinedShape.AbstractBase {

/**
* The loaded constructor that is represented by this instance.
Expand All @@ -696,7 +696,7 @@ public GenericTypeDescription getReturnType() {
}

@Override
public ParameterList<ParameterDescription.InDeclaredForm> getParameters() {
public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
return ParameterList.ForLoadedExecutable.of(constructor);
}

Expand Down Expand Up @@ -769,7 +769,7 @@ public GenericTypeList getTypeVariables() {
/**
* An implementation of a method description for a loaded method.
*/
class ForLoadedMethod extends InDeclaredForm.AbstractBase {
class ForLoadedMethod extends inDefinedShape.AbstractBase {

/**
* The loaded method that is represented by this instance.
Expand All @@ -796,7 +796,7 @@ public GenericTypeDescription getReturnType() {
}

@Override
public ParameterList<ParameterDescription.InDeclaredForm> getParameters() {
public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
return ParameterList.ForLoadedExecutable.of(method);
}

Expand Down Expand Up @@ -887,7 +887,7 @@ public GenericTypeList getTypeVariables() {
* A latent method description describes a method that is not attached to a declaring
* {@link TypeDescription}.
*/
class Latent extends InDeclaredForm.AbstractBase {
class Latent extends inDefinedShape.AbstractBase {

/**
* The type that is declaring this method.
Expand Down Expand Up @@ -996,7 +996,7 @@ public GenericTypeDescription getReturnType() {
}

@Override
public ParameterList<ParameterDescription.InDeclaredForm> getParameters() {
public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
return new ParameterList.ForTokens(this, parameterTokens);
}

Expand Down Expand Up @@ -1033,7 +1033,7 @@ public Object getDefaultValue() {
/**
* A method description that represents the type initializer.
*/
public static class TypeInitializer extends InDeclaredForm.AbstractBase {
public static class TypeInitializer extends inDefinedShape.AbstractBase {

/**
* The type for which the type initializer should be represented.
Expand All @@ -1055,7 +1055,7 @@ public GenericTypeDescription getReturnType() {
}

@Override
public ParameterList<ParameterDescription.InDeclaredForm> getParameters() {
public ParameterList<ParameterDescription.InDefinedShape> getParameters() {
return new ParameterList.Empty();
}

Expand Down Expand Up @@ -1177,8 +1177,8 @@ public String getInternalName() {
}

@Override
public InDeclaredForm asDeclared() {
return methodDescription.asDeclared();
public inDefinedShape asDefined() {
return methodDescription.asDefined();
}

/**
Expand Down
Expand Up @@ -36,7 +36,7 @@ public interface MethodList<T extends MethodDescription> extends FilterableList<
*/
ByteCodeElement.Token.TokenList<MethodDescription.Token> asTokenList(ElementMatcher<? super TypeDescription> targetTypeMatcher);

MethodList<MethodDescription.InDeclaredForm> asDeclared();
MethodList<MethodDescription.inDefinedShape> asDefined();

/**
* A base implementation of a {@link MethodList}.
Expand All @@ -63,20 +63,20 @@ public ByteCodeElement.Token.TokenList<MethodDescription.Token> asTokenList(Elem
}

@Override
public MethodList<MethodDescription.InDeclaredForm> asDeclared() {
List<MethodDescription.InDeclaredForm> declaredForms = new ArrayList<MethodDescription.InDeclaredForm>(size());
public MethodList<MethodDescription.inDefinedShape> asDefined() {
List<MethodDescription.inDefinedShape> declaredForms = new ArrayList<MethodDescription.inDefinedShape>(size());
for (MethodDescription methodDescription : this) {
declaredForms.add(methodDescription.asDeclared());
declaredForms.add(methodDescription.asDefined());
}
return new Explicit<MethodDescription.InDeclaredForm>(declaredForms);
return new Explicit<MethodDescription.inDefinedShape>(declaredForms);
}
}

/**
* A method list implementation that returns all loaded byte code methods (methods and constructors) that
* are declared for a given type.
*/
class ForLoadedType extends AbstractBase<MethodDescription.InDeclaredForm> {
class ForLoadedType extends AbstractBase<MethodDescription.inDefinedShape> {

/**
* The loaded methods that are represented by this method list.
Expand Down Expand Up @@ -121,7 +121,7 @@ public ForLoadedType(List<? extends Constructor<?>> constructors, List<? extends
}

@Override
public MethodDescription.InDeclaredForm get(int index) {
public MethodDescription.inDefinedShape get(int index) {
return index < constructors.size()
? new MethodDescription.ForLoadedConstructor(constructors.get(index))
: new MethodDescription.ForLoadedMethod(methods.get(index - constructors.size()));
Expand Down Expand Up @@ -167,7 +167,7 @@ public int size() {
/**
* A list of method descriptions for a list of detached tokens. For the returned method, each token is attached to its method representation.
*/
class ForTokens extends AbstractBase<MethodDescription.InDeclaredForm> {
class ForTokens extends AbstractBase<MethodDescription.inDefinedShape> {

/**
* The method's declaring type.
Expand All @@ -191,7 +191,7 @@ public ForTokens(TypeDescription declaringType, List<? extends MethodDescription
}

@Override
public MethodDescription.InDeclaredForm get(int index) {
public MethodDescription.inDefinedShape get(int index) {
return new MethodDescription.Latent(declaringType, tokens.get(index));
}

Expand Down Expand Up @@ -250,8 +250,8 @@ public int size() {
/**
* An implementation of an empty method list.
*/
class Empty extends FilterableList.Empty<MethodDescription.InDeclaredForm, MethodList<MethodDescription.InDeclaredForm>>
implements MethodList<MethodDescription.InDeclaredForm> {
class Empty extends FilterableList.Empty<MethodDescription.inDefinedShape, MethodList<MethodDescription.inDefinedShape>>
implements MethodList<MethodDescription.inDefinedShape> {

@Override
public ByteCodeElement.Token.TokenList<MethodDescription.Token> asTokenList() {
Expand All @@ -264,7 +264,7 @@ public ByteCodeElement.Token.TokenList<MethodDescription.Token> asTokenList(Elem
}

@Override
public MethodList<MethodDescription.InDeclaredForm> asDeclared() {
public MethodList<MethodDescription.inDefinedShape> asDefined() {
return this;
}
}
Expand Down

0 comments on commit adb17e0

Please sign in to comment.