| Method from org.jfree.report.style.StyleKey Detail: |
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
|
public boolean equals(Object o) {
if (this == o)
{
return true;
}
if (!(o instanceof StyleKey))
{
return false;
}
final StyleKey key = (StyleKey) o;
if (!name.equals(key.name))
{
return false;
}
if (!valueType.equals(key.valueType))
{
return false;
}
return true;
}
Indicates whether some other object is "equal to" this one. |
public static int getDefinedStyleKeyCount() {
return definedKeySize;
}
|
public static synchronized StyleKey[] getDefinedStyleKeys() {
if (definedKeys == null)
{
logger.warn("The engine has not been booted and the default keys have no been registered yet.");
registerDefaults();
}
return (StyleKey[]) definedKeys.values().toArray(new StyleKey[definedKeys.size()]);
}
|
public int getIdentifier() {
return identifier;
}
|
public String getName() {
return name;
}
Returns the name of the key. |
public static synchronized StyleKey getStyleKey(String name) {
if (definedKeys == null)
{
return null;
}
else
{
return (StyleKey) definedKeys.get(name);
}
}
Returns the key with the specified name. |
public static StyleKey getStyleKey(String name,
Class valueType) {
return getStyleKey(name, valueType, false, true);
}
Returns the key with the specified name. The given type is not checked against a
possibly alredy defined definition, it is assumed that the type is only given for a
new key definition. |
public static synchronized StyleKey getStyleKey(String name,
Class valueType,
boolean trans,
boolean inheritable) {
if (definedKeys == null)
{
definedKeys = new HashMap();
definedKeySize = 0;
}
StyleKey key = (StyleKey) definedKeys.get(name);
if (key == null)
{
key = new StyleKey(name, valueType, trans, inheritable);
definedKeys.put(name, key);
definedKeySize = definedKeys.size();
}
return key;
}
Returns the key with the specified name. The given type is not checked against a
possibly alredy defined definition, it is assumed that the type is only given for a
new key definition. |
public Class getValueType() {
return valueType;
}
Returns the class of the value for this key. |
public int hashCode() {
return identifier;
}
Returns a hash code value for the object. This method is supported for the benefit of
hashtables such as those provided by java.util.Hashtable.
|
public boolean isInheritable() {
return inheritable;
}
|
public boolean isTransient() {
return trans;
}
|
public static synchronized void registerClass(Class c) {
// Log.debug ("Registering stylekeys from " + c);
try
{
final Field[] fields = c.getFields();
for (int i = 0; i < fields.length; i++)
{
final Field field = fields[i];
final int modifiers = field.getModifiers();
if (Modifier.isPublic(modifiers) &&
Modifier.isStatic(modifiers))
{
if (Modifier.isFinal(modifiers) == false)
{
logger.warn("Invalid implementation: StyleKeys should be 'public static final': " + c);
}
if (field.getType().isAssignableFrom(StyleKey.class))
{
final StyleKey value = (StyleKey) field.get(null);
// ignore the returned value, all we want is to trigger the key
// creation
// Log.debug ("Loaded key " + value);
}
}
}
}
catch (IllegalAccessException e)
{
// wont happen, we've checked it..
logger.warn("Unable to register keys from " + c.getName());
}
}
|
public static synchronized void registerDefaults() {
final Configuration config = JFreeReportBoot.getInstance().getGlobalConfig();
final Iterator it = config.findPropertyKeys("org.jfree.report.stylekeys.");
final ClassLoader classLoader = ObjectUtilities.getClassLoader(StyleKey.class);
while (it.hasNext())
{
final String key = (String) it.next();
final String keyClass = config.getConfigProperty(key);
try
{
final Class c = classLoader.loadClass(keyClass);
registerClass(c);
}
catch (ClassNotFoundException e)
{
// ignore that class
logger.warn("Unable to register keys from " + keyClass);
}
catch (NullPointerException e)
{
// ignore invalid values as well.
logger.warn("Unable to register keys from " + keyClass);
}
}
}
|
public String toString() {
final StringBuffer b = new StringBuffer(100);
b.append("StyleKey={name='");
b.append(getName());
b.append("', valueType='");
b.append(getValueType());
b.append("'}");
return b.toString();
}
Returns a string representation of the object. |