Package classycle

# Class ClassAttributes

java.lang.Object
classycle.graph.NameAttributes
classycle.NameAndSourceAttributes
classycle.ClassAttributes

All Implemented Interfaces:
  `Attributes`, `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 final String`
`ABSTRACT_CLASS`
Type constant.
`static final String`
`CLASS`
Type constant.
`static final String`
`INTERFACE`
Type constant.
`static final String`
`UNKNOWN`
Type constant.

## Constructor Summary

Constructors
Constructor
Description
`ClassAttributes(String name, String source, String type, int size)`
Creates an instance based on the specified name, type, and size.

## Method Summary

Modifier and Type
Method
Description
`static ClassAttributes`
`createAbstractClass(String name, String source, int size)`
Creates an instance of the type `ABSTRACT_CLASS`.
`static ClassAttributes`
`createClass(String name, String source, int size)`
Creates an instance of the type `CLASS`.
`static ClassAttributes`
`createInterface(String name, String source, int size)`
Creates an instance of the type `INTERFACE`.
`static ClassAttributes`
`createUnknownClass(String name, int size)`
Creates an instance of the type `UNKNOWN`.
`int`
`getSize()`
Returns the size of the class file in bytes.
`String`
`getType()`
Returns the class type.
`boolean`
`isInnerClass()`
Returns `true` in the case of an inner class.
`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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### INTERFACE

public static final String INTERFACE
Type constant.

See Also:
  - Constant Field Values

### ABSTRACT_CLASS

public static final String ABSTRACT_CLASS
Type constant.

See Also:
  - Constant Field Values

### CLASS

public static final String CLASS
Type constant.

See Also:
  - Constant Field Values

### UNKNOWN

public static final String UNKNOWN
Type constant.

See Also:
  - Constant Field Values

## Constructor Details

### ClassAttributes

public ClassAttributes(String name, String source, 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 be `null`.
  `type` - Type.
  `size` - Size.

## Method Details

### createInterface

public static ClassAttributes createInterface(String name, String source, int size)
Creates an instance of the type `INTERFACE`.

Parameters:
  `name` - Fully-qualified class name.
  `source` - Optional source of the class file. Can be `null`.
  `size` - Size of the class file.
Returns:
  a new instance.

### createAbstractClass

public static ClassAttributes createAbstractClass(String name, String source, int size)
Creates an instance of the type `ABSTRACT_CLASS`.

Parameters:
  `name` - Fully-qualified class name.
  `source` - Optional source of the class file. Can be `null`.
  `size` - Size of the class file.
Returns:
  a new instance.

### createClass

public static ClassAttributes createClass(String name, String source, int size)
Creates an instance of the type `CLASS`.

Parameters:
  `name` - Fully-qualified class name.
  `source` - Optional source of the class file. Can be `null`.
  `size` - Size of the class file.
Returns:
  a new instance.

### createUnknownClass

public static ClassAttributes createUnknownClass(String name, int size)
Creates an instance of the type `UNKNOWN`.

Parameters:
  `name` - Fully-qualified class name.
  `size` - Size of the class file.
Returns:
  a new instance.

### getType

public String getType()
Returns the class type.

Returns:
  either `INTERFACE`, `ABSTRACT_CLASS`, `CLASS`, or `UNKNOWN`.

### 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 class `NameAttributes`

### toString

public String toString()
Returns the attributes as a string for pretty printing.

Overrides:
  `toString` in class `Object`