[Clirr-devel] CVS: clirr/core/src/java/net/sf/clirr/core/spi Named.java,NONE,1.1 Scope.java,NONE,1.1
Status: Alpha
Brought to you by:
lkuehne
Update of /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/spi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7638/src/java/net/sf/clirr/core/spi Added Files: Named.java Scope.java Method.java Scoped.java Field.java JavaType.java package.html Log Message: added spi package --- NEW FILE --- package net.sf.clirr.core.spi; /** * A named entity in the Java programming language. * * @author lkuehne */ public interface Named { /** * Returns the name of this object. */ String getName(); } --- NEW FILE --- package net.sf.clirr.core.spi; /** * Enumeration type that represents an "accessibility" level for * a java class, field or method. * <p> * Change of access rights from lower to higher visibility rating is a * binary-compatible change. Change of access rights from higher to * lower is a binary-incompatible change. * <p> * Public > Protected > Package > Private * * @author Simon Kitching */ public final class Scope { private int vis; private String desc; private String decl; /** Object representing private scoped objects. */ public static final Scope PRIVATE = new Scope(0, "private", "private"); /** Object representing package scoped objects. */ public static final Scope PACKAGE = new Scope(1, "package", ""); /** Object representing protected scoped objects. */ public static final Scope PROTECTED = new Scope(2, "protected", "protected"); /** Object representing public scoped objects. */ public static final Scope PUBLIC = new Scope(3, "public", "public"); private Scope(int vis, String desc, String decl) { this.vis = vis; this.desc = desc; this.decl = decl; } public boolean isMoreVisibleThan(Scope v) { return this.vis > v.vis; } public boolean isLessVisibleThan(Scope v) { return this.vis < v.vis; } public String getDesc() { return desc; } /** the Java visibility modifier. **/ public String getDecl() { return decl; } } --- NEW FILE --- package net.sf.clirr.core.spi; /** * Describes a Java method. */ public interface Method extends Named, Scoped { /** * * @return the return type of this method, or null if the method return type is <code>void</code> */ JavaType getReturnType(); /** * * @return the argument types of this method, never null. */ JavaType[] getArgumentTypes(); // JavaType[] getDeclaredExceptions(); boolean isFinal(); boolean isStatic(); boolean isAbstract(); boolean isDeprecated(); } --- NEW FILE --- package net.sf.clirr.core.spi; /** * A Java source code entity like a type or a method that has the * concept of a visibility scope. * * Each entity has two scopes: One that is declared and the effective scope. * For example a public method can have an effective scope of package if it * appears in a class that is package visible. * * @author lk * */ public interface Scoped { /** * The declared scope of this entity. * @return the scope that appears in the modifiers of this entity. */ Scope getDeclaredScope(); /** * The effective Scope of this entity. * * @return the minimum scope of the modifiers of this entity and * it's all of it's containers. */ Scope getEffectiveScope(); } --- NEW FILE --- package net.sf.clirr.core.spi; /** * Describes a field of a class. */ public interface Field extends Named, Scoped { /** * The type of this field. */ JavaType getType(); /** * Whether the field is declared as final. */ boolean isFinal(); /** * Whether the field is declared as static. */ boolean isStatic(); /** * Whether the field is deprecated. */ boolean isDeprecated(); /** * Returns the constant value of this field. * The constant value is an Object if the field is static and final and the java compiler * could calculate the value at compilation time. * * @return the constant value or <code>null</code> if the compiler could * not calculate the value at compilation time */ Object getConstantValue(); } --- NEW FILE --- package net.sf.clirr.core.spi; /** * A Java Type (Object, Interface, primitive type or void). * * @author lkuehne */ public interface JavaType extends Named, Scoped { /** * Type fully qualified class name. * * @return a fully qualified class name, * like <code>"my.company.procuct.SampleClass"</code>. */ String getName(); /** * The containing class if this is an inner class. * * @return the containing class or <code>null</code> * if this JavaType does not represent an inner class. */ JavaType getContainingClass(); /** * Return the superclasses of this class. * * @return the chain of superclasses of this type, starting from * the direct superclass and ending with <code>java.lang.Object</code>. */ JavaType[] getSuperClasses(); /** * Return the list of all interfaces this class implements. * * @return the list of all interfaces this class implements/extends, * excluding <code>this</code> if this JavaType represents an interface itself. */ JavaType[] getAllInterfaces(); JavaType[] getInnerClasses(); /** * All methods that are declared by this class. * Methods of superclasses/interfaces are not returned * if they are not overridden/redeclared here. * * @return all methods that are declared by this class. */ Method[] getMethods(); /** * All fields that are declared by this class. * Fields of superclasses/interfaces are not returned. * * @return all fields that are declared by this class. */ Field[] getFields(); boolean isPrimitive(); boolean isArray(); boolean isFinal(); boolean isAbstract(); boolean isInterface(); } --- NEW FILE --- <html> <body> Service Provider Interface for letting Clirr know about Java types, methods, etc. This package is intended to <ul> <li> Decouple the current BCEL implementation from the comparison algorithms (separation of concerns). </li> <li> Allow IDE plugins to provide an implementation that is based on the internal Java representation of the IDE. This allows instantatious error marker feedback, building class files or jars on disk is not required. </li> </ul> </body> </html> |