Package classycle
Class ClassAttributes
- java.lang.Object
-
- classycle.graph.NameAttributes
-
- classycle.NameAndSourceAttributes
-
- classycle.ClassAttributes
-
- All Implemented Interfaces:
Attributes
,java.lang.Comparable<Attributes>
public class ClassAttributes extends NameAndSourceAttributes
Immutable class holding the attributes of a class vertex. They are- fully-qualified class name
- type (interface, abstract, concrete, unknown)
- flag innerClass
- size of the class file
- Author:
- Franz-Josef Elmer
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ABSTRACT_CLASS
Type constant.static java.lang.String
CLASS
Type constant.static java.lang.String
INTERFACE
Type constant.static java.lang.String
UNKNOWN
Type constant.
-
Constructor Summary
Constructors Constructor Description ClassAttributes(java.lang.String name, java.lang.String source, java.lang.String type, int size)
Creates an instance based on the specified name, type, and size.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClassAttributes
createAbstractClass(java.lang.String name, java.lang.String source, int size)
Creates an instance of the typeABSTRACT_CLASS
.static ClassAttributes
createClass(java.lang.String name, java.lang.String source, int size)
Creates an instance of the typeCLASS
.static ClassAttributes
createInterface(java.lang.String name, java.lang.String source, int size)
Creates an instance of the typeINTERFACE
.static ClassAttributes
createUnknownClass(java.lang.String name, int size)
Creates an instance of the typeUNKNOWN
.int
getSize()
Returns the size of the class file in bytes.java.lang.String
getType()
Returns the class type.boolean
isInnerClass()
Returns true in the case of an inner class.java.lang.String
toString()
Returns the attributes as a string for pretty printing.-
Methods inherited from class classycle.NameAndSourceAttributes
addSource, addSourcesOf, getSources
-
Methods inherited from class classycle.graph.NameAttributes
compareTo, getName
-
-
-
-
Field Detail
-
INTERFACE
public static final java.lang.String INTERFACE
Type constant.- See Also:
- Constant Field Values
-
ABSTRACT_CLASS
public static final java.lang.String ABSTRACT_CLASS
Type constant.- See Also:
- Constant Field Values
-
CLASS
public static final java.lang.String CLASS
Type constant.- See Also:
- Constant Field Values
-
UNKNOWN
public static final java.lang.String UNKNOWN
Type constant.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ClassAttributes
public ClassAttributes(java.lang.String name, java.lang.String source, java.lang.String type, int size)
Creates an instance based on the specified name, type, and size. The innerclass flag will be set if the name contains a '$' character.- Parameters:
name
- Fully-qualified class name.source
- Optional source of the class file. Can benull
.type
- Type.size
- Size.
-
-
Method Detail
-
createInterface
public static ClassAttributes createInterface(java.lang.String name, java.lang.String source, int size)
Creates an instance of the typeINTERFACE
.- Parameters:
name
- Fully-qualified class name.source
- Optional source of the class file. Can benull
.size
- Size of the class file.- Returns:
- a new instance.
-
createAbstractClass
public static ClassAttributes createAbstractClass(java.lang.String name, java.lang.String source, int size)
Creates an instance of the typeABSTRACT_CLASS
.- Parameters:
name
- Fully-qualified class name.source
- Optional source of the class file. Can benull
.size
- Size of the class file.- Returns:
- a new instance.
-
createClass
public static ClassAttributes createClass(java.lang.String name, java.lang.String source, int size)
Creates an instance of the typeCLASS
.- Parameters:
name
- Fully-qualified class name.source
- Optional source of the class file. Can benull
.size
- Size of the class file.- Returns:
- a new instance.
-
createUnknownClass
public static ClassAttributes createUnknownClass(java.lang.String name, int size)
Creates an instance of the typeUNKNOWN
.- Parameters:
name
- Fully-qualified class name.size
- Size of the class file.- Returns:
- a new instance.
-
getType
public java.lang.String getType()
Returns the class type.- Returns:
- either
INTERFACE
,ABSTRACT_CLASS
,CLASS
, orUNKNOWN
.
-
isInnerClass
public boolean isInnerClass()
Returns true in the case of an inner class.
-
getSize
public int getSize()
Returns the size of the class file in bytes.- Specified by:
getSize
in classNameAttributes
-
toString
public java.lang.String toString()
Returns the attributes as a string for pretty printing.- Overrides:
toString
in classjava.lang.Object
-
-