Skip to content

Commit

Permalink
Roaster 35 (#70)
Browse files Browse the repository at this point in the history
* ROASTER-35: Add PropertyHolderSource.getProperties(Class<?>)

* Code cleanup: Remove redundant interface modifiers
  • Loading branch information
windmueller authored and gastaldi committed Nov 17, 2016
1 parent 96b5f84 commit 45dce4c
Show file tree
Hide file tree
Showing 29 changed files with 129 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
*/
public interface Abstractable<T>
{
public abstract boolean isAbstract();
boolean isAbstract();
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface AnnotationElement<O extends JavaAnnotation<O>> extends Annotati
/**
* Represents the default value of a given {@link AnnotationElement}.
*/
public interface ReadDefaultValue<O extends JavaAnnotation<O>>
interface ReadDefaultValue<O extends JavaAnnotation<O>>
{
String getString();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public interface EnumConstant<O extends JavaEnum<O>> extends Internal, Origin<O>
/**
* Represents the anonymous subclass "body" of a {@link EnumConstant}.
*/
public interface ReadBody<O extends ReadBody<O>> extends JavaType<O>, FieldHolder<O>, MethodHolder<O>
interface ReadBody<O extends ReadBody<O>> extends JavaType<O>, FieldHolder<O>, MethodHolder<O>
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public interface Extendable<O extends JavaType<O>>
*
* @see #setSuperType(String)
*/
public String getSuperType();
String getSuperType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ public interface FieldHolder<O extends JavaType<O>> extends MemberHolder<O>
/**
* Return whether or not this {@link O} declares a {@link Field} with the given name.
*/
public boolean hasField(String name);
boolean hasField(String name);

/**
* Return whether or not this {@link O} declares the given {@link Field} instance.
*/
public boolean hasField(Field<O> field);
boolean hasField(Field<O> field);

/**
* Get the {@link Field} with the given name and return it, otherwise, return null.
*/
public Field<O> getField(String name);
Field<O> getField(String name);

/**
* Get a list of all {@link Field}s declared by this {@link O}, or return an empty list if no {@link Field}s are
* declared.
*/
public List<? extends Field<O>> getFields();
List<? extends Field<O>> getFields();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ public interface JavaAnnotation<O extends JavaAnnotation<O>> extends JavaType<O>
/**
* Return whether or not this {@link JavaAnnotation} declares an {@link AnnotationElement} with the given name.
*/
public boolean hasAnnotationElement(String name);
boolean hasAnnotationElement(String name);

/**
* Return whether or not this {@link JavaAnnotation} declares the given {@link AnnotationElement} instance.
*/
public boolean hasAnnotationElement(AnnotationElement<?> annotationElement);
boolean hasAnnotationElement(AnnotationElement<?> annotationElement);

/**
* Get the {@link AnnotationElement} with the given name and return it, otherwise, return null.
*/
public AnnotationElement<O> getAnnotationElement(String name);
AnnotationElement<O> getAnnotationElement(String name);

/**
* Get a list of all {@link AnnotationElement}s declared by this {@link JavaAnnotation}, or return an empty list if
* no {@link AnnotationElement}s are declared.
*/
public List<? extends AnnotationElement<O>> getAnnotationElements();
List<? extends AnnotationElement<O>> getAnnotationElements();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ public interface JavaClass<O extends JavaClass<O>> extends
* @see JSL 14.3. Local Class Declarations
* @return <code>true</code> if this {@link JavaClass} represents a local class.
*/
public boolean isLocalClass();
boolean isLocalClass();

}
20 changes: 10 additions & 10 deletions api/src/main/java/org/jboss/forge/roaster/model/JavaType.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface JavaType<T extends JavaType<T>> extends
* Return the canonical name of this {@link T} instance. This is equivalent to calling
* {@link Class#getCanonicalName()}
*/
public String getCanonicalName();
String getCanonicalName();

/**
* Get the qualified-name of this {@link T} instance, where the qualified-name contains both the Java package and
Expand All @@ -38,48 +38,48 @@ public interface JavaType<T extends JavaType<T>> extends
* <strong>For example</strong>, calling: {@link #getQualifiedName()} is equivalent to calling "{@link #getPackage()}
* + "." + {@link #getName()}", which in turn is equivalent to calling: {@link Class#getName()}
*/
public String getQualifiedName();
String getQualifiedName();

/**
* Get a list of all {@link SyntaxError}s detected in the current {@link T}. Note that when errors are present, the
* class may still be modified, but changes may not be completely accurate.
*/
public List<SyntaxError> getSyntaxErrors();
List<SyntaxError> getSyntaxErrors();

/**
* Return whether or not this {@link T} currently has any {@link SyntaxError} s.
*/
public boolean hasSyntaxErrors();
boolean hasSyntaxErrors();

/**
* Return <code>true</code> if this {@link JavaType} represents a {@link JavaClass}
*/
public boolean isClass();
boolean isClass();

/**
* Return <code>true</code> if this {@link JavaType} represents a {@link JavaEnum}
*/
public boolean isEnum();
boolean isEnum();

/**
* Return <code>true</code> if this {@link JavaType} represents a {@link JavaClass} interface.
*/
public boolean isInterface();
boolean isInterface();

/**
* Return <code>true</code> if this {@link JavaType} represents a {@link JavaAnnotation}
*/
public boolean isAnnotation();
boolean isAnnotation();

/**
* Return the enclosing {@link JavaType} type in which this class is defined. If this class is a top-level type, and
* is not a nested type, this object will return itself.
*/
public JavaType<?> getEnclosingType();
JavaType<?> getEnclosingType();

/**
* Return the generated code without any formatting.
*/
public String toUnformattedString();
String toUnformattedString();

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public interface MemberHolder<O extends JavaType<O>>
/**
* Return a list of all class members (fields, methods, etc.)
*/
public List<? extends Member<O>> getMembers();
List<? extends Member<O>> getMembers();
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,46 @@ public interface MethodHolder<O extends JavaType<O>> extends MemberHolder<O>
/**
* Return true if this {@link O} has a method with the given name and zero parameters; otherwise return false.
*/
public boolean hasMethod(final Method<O, ?> name);
boolean hasMethod(final Method<O, ?> name);

/**
* Return true if this {@link O} has a method with signature matching the given method's signature.
*/
public boolean hasMethodSignature(final Method<?, ?> method);
boolean hasMethodSignature(final Method<?, ?> method);

/**
* Return true if this {@link O} has a method with the given name and zero parameters; otherwise return false.
*/
public boolean hasMethodSignature(final String name);
boolean hasMethodSignature(final String name);

/**
* Return true if this {@link O} has a method with the given name and signature types; otherwise return false.
*/
public boolean hasMethodSignature(final String name, String... paramTypes);
boolean hasMethodSignature(final String name, String... paramTypes);

/**
* Return true if this {@link O} has a method with the given name and signature types; otherwise return false.
*/
public boolean hasMethodSignature(final String name, Class<?>... paramTypes);
boolean hasMethodSignature(final String name, Class<?>... paramTypes);

/**
* Return the {@link Method} with the given name and zero parameters; otherwise return null.
*/
public Method<O, ?> getMethod(final String name);
Method<O, ?> getMethod(final String name);

/**
* Return the {@link Method} with the given name and signature types; otherwise return null.
*/
public Method<O, ?> getMethod(final String name, String... paramTypes);
Method<O, ?> getMethod(final String name, String... paramTypes);

/**
* Return the {@link Method} with the given name and signature types; otherwise return null.
*/
public Method<O, ?> getMethod(final String name, Class<?>... paramTypes);
Method<O, ?> getMethod(final String name, Class<?>... paramTypes);

/**
* Get a {@link List} of all {@link Method}s declared by this {@link O} instance, if any; otherwise, return an empty
* {@link List}
*/
public List<? extends Method<O, ?>> getMethods();
List<? extends Method<O, ?>> getMethods();
}
2 changes: 1 addition & 1 deletion api/src/main/java/org/jboss/forge/roaster/model/Named.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ public interface Named
* <code>{@link Class#getSimpleName()}.</code> For a Java method, this would be equivalent to calling
* {@link Method#getName()} ... and so on.
*/
public String getName();
String getName();
}
4 changes: 2 additions & 2 deletions api/src/main/java/org/jboss/forge/roaster/model/Packaged.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public interface Packaged<T>
/**
* Get the package of this {@link T}, or return null if it is in the default package.
*/
public String getPackage();
String getPackage();

/**
* Return whether or not this {@link T} is in the default package.
*/
public boolean isDefaultPackage();
boolean isDefaultPackage();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public interface PropertyHolder<O extends JavaType<O>> extends MethodHolder<O>,
*/
Property<O> getProperty(String name);

/**
* Get a list of all {@link Property Properties} declared by this {@link O} with the given type,
* or return an empty list if no matching {@link Property Properties} are declared.
*/
List<? extends Property<O>> getProperties(Class<?> type);

/**
* Get a list of all {@link Property Properties} declared by this {@link O}, or return an empty list if no
* {@link Property Properties} are declared.
Expand Down
10 changes: 5 additions & 5 deletions api/src/main/java/org/jboss/forge/roaster/model/SyntaxError.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ public interface SyntaxError
/**
* Get a textual description of the type of problem encountered.
*/
public String getDescription();
String getDescription();

/**
* Gets the 1 based line number for the syntax error whenever it's possible to calculate it, or < 0 when the line is
* unknown.
*/
public int getLine();
int getLine();

/**
* Get the 0 based column number for the error start whenever it's possible to calculate it, or < 0 when the column
* is unknown.
*/
public int getColumn();
int getColumn();

/**
* True if the syntax error is an error, false in any other case. (see isWarning())
*
* @return
*/
public boolean isError();
boolean isError();

/**
* True if the syntax error is a warning, false in any other case. (see isError())
*
* @return
*/
public boolean isWarning();
boolean isWarning();

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
*/
public interface AbstractableSource<T> extends Abstractable<T>
{
public abstract T setAbstract(boolean abstrct);
T setAbstract(boolean abstrct);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface AnnotationElementSource extends AnnotationElement<JavaAnnotatio
/**
* Represents the default value of an {@link AnnotationElementSource} and provides mechanisms to set that value.
*/
public interface DefaultValue extends AnnotationElement.ReadDefaultValue<JavaAnnotationSource>
interface DefaultValue extends AnnotationElement.ReadDefaultValue<JavaAnnotationSource>
{
@Override
AnnotationSource<JavaAnnotationSource> getAnnotation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface EnumConstantSource extends EnumConstant<JavaEnumSource>,
/**
* Represents the anonymous subclass "body" of an {@link EnumConstantSource}.
*/
public interface Body extends EnumConstant.ReadBody<Body>, JavaSource<Body>, FieldHolderSource<Body>,
interface Body extends EnumConstant.ReadBody<Body>, JavaSource<Body>, FieldHolderSource<Body>,
MethodHolderSource<Body>, TypeHolderSource<Body>
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,30 @@ public interface ExtendableSource<O extends JavaType<O>> extends Extendable<O>
*
* @see #setSuperType(String)
*/
public O setSuperType(JavaType<?> type);
O setSuperType(JavaType<?> type);

/**
* Set this type's super class.
*
* @see #setSuperType(String)
*/
public O setSuperType(Class<?> type);
O setSuperType(Class<?> type);

/**
* Set this type's super class and import their abstract methods, if any.
*
* @see #setSuperType(String)
* @see Methods#implementAbstractMethods(Class, MethodHolderSource)
*/
public O extendSuperType(Class<?> type);
O extendSuperType(Class<?> type);

/**
* Set this type's super class and import their abstract methods, if any.
*
* @see #setSuperType(String)
* @see Methods#implementAbstractMethods(Class, MethodHolderSource)
*/
public O extendSuperType(JavaClass<?> type);
O extendSuperType(JavaClass<?> type);

/**
* Set this type's super class.
Expand All @@ -60,5 +60,5 @@ public interface ExtendableSource<O extends JavaType<O>> extends Extendable<O>
* Attempt to add an import statement to this object's {@link O} if required. (Note that the given className must be
* fully-qualified in order to properly import required classes)
*/
public O setSuperType(String type);
O setSuperType(String type);
}
Loading

0 comments on commit 45dce4c

Please sign in to comment.