RoleInfopublic class RoleInfo extends Object implements SerializableA RoleInfo object summarises a role in a relation type.
The serialVersionUID of this class is 2504952983494636987L . |
Fields Summary |
---|
private static final long | oldSerialVersionUID | private static final long | newSerialVersionUID | private static final ObjectStreamField[] | oldSerialPersistentFields | private static final ObjectStreamField[] | newSerialPersistentFields | private static final long | serialVersionUID | private static final ObjectStreamField[] | serialPersistentFields | private static boolean | compat | public static final int | ROLE_CARDINALITY_INFINITYTo specify an unlimited cardinality. | private String | name | private boolean | isReadable | private boolean | isWritable | private String | description | private int | minDegree | private int | maxDegree | private String | referencedMBeanClassName |
Constructors Summary |
---|
public RoleInfo(String roleName, String mbeanClassName, boolean read, boolean write, int min, int max, String descr)Constructor.
//
// Constructors
//
init(roleName,
mbeanClassName,
read,
write,
min,
max,
descr);
return;
| public RoleInfo(String roleName, String mbeanClassName, boolean read, boolean write)Constructor.
try {
init(roleName,
mbeanClassName,
read,
write,
1,
1,
null);
} catch (InvalidRoleInfoException exc) {
// OK : Can never happen as the minimum
// degree equals the maximum degree.
}
return;
| public RoleInfo(String roleName, String mbeanClassName)Constructor.
try {
init(roleName,
mbeanClassName,
true,
true,
1,
1,
null);
} catch (InvalidRoleInfoException exc) {
// OK : Can never happen as the minimum
// degree equals the maximum degree.
}
return;
| public RoleInfo(RoleInfo roleInfo)Copy constructor.
if (roleInfo == null) {
// Revisit [cebro] Localize message
String excMsg = "Invalid parameter.";
throw new IllegalArgumentException(excMsg);
}
try {
init(roleInfo.getName(),
roleInfo.getRefMBeanClassName(),
roleInfo.isReadable(),
roleInfo.isWritable(),
roleInfo.getMinDegree(),
roleInfo.getMaxDegree(),
roleInfo.getDescription());
} catch (InvalidRoleInfoException exc3) {
// OK : Can never happen as the minimum degree and the maximum
// degree were already checked at the time the roleInfo
// instance was created.
}
|
Methods Summary |
---|
public boolean | checkMaxDegree(int value)Returns true if the value parameter is lower than or equal to
the expected maximum degree, false otherwise.
if (value >= ROLE_CARDINALITY_INFINITY &&
(maxDegree == ROLE_CARDINALITY_INFINITY ||
(value != ROLE_CARDINALITY_INFINITY &&
value <= maxDegree))) {
return true;
} else {
return false;
}
| public boolean | checkMinDegree(int value)Returns true if the value parameter is greater than or equal to
the expected minimum degree, false otherwise.
if (value >= ROLE_CARDINALITY_INFINITY &&
(minDegree == ROLE_CARDINALITY_INFINITY
|| value >= minDegree)) {
return true;
} else {
return false;
}
| public java.lang.String | getDescription()Returns description text for the role.
return description;
| public int | getMaxDegree()Returns maximum degree for corresponding role reference.
return maxDegree;
| public int | getMinDegree()Returns minimum degree for corresponding role reference.
return minDegree;
| public java.lang.String | getName()Returns the name of the role.
return name;
| public java.lang.String | getRefMBeanClassName()Returns name of type of MBean expected to be referenced in
corresponding role.
return referencedMBeanClassName;
| private void | init(java.lang.String roleName, java.lang.String mbeanClassName, boolean read, boolean write, int min, int max, java.lang.String descr)
if (roleName == null ||
mbeanClassName == null) {
// Revisit [cebro] Localize message
String excMsg = "Invalid parameter.";
throw new IllegalArgumentException(excMsg);
}
name = roleName;
isReadable = read;
isWritable = write;
if (descr != null) {
description = descr;
}
boolean invalidRoleInfoFlg = false;
StringBuffer excMsgStrB = new StringBuffer();
if (max != ROLE_CARDINALITY_INFINITY &&
(min == ROLE_CARDINALITY_INFINITY ||
min > max)) {
// Revisit [cebro] Localize message
excMsgStrB.append("Minimum degree ");
excMsgStrB.append(min);
excMsgStrB.append(" is greater than maximum degree ");
excMsgStrB.append(max);
invalidRoleInfoFlg = true;
} else if (min < ROLE_CARDINALITY_INFINITY ||
max < ROLE_CARDINALITY_INFINITY) {
// Revisit [cebro] Localize message
excMsgStrB.append("Minimum or maximum degree has an illegal value, must be [0, ROLE_CARDINALITY_INFINITY].");
invalidRoleInfoFlg = true;
}
if (invalidRoleInfoFlg) {
throw new InvalidRoleInfoException(excMsgStrB.toString());
}
minDegree = min;
maxDegree = max;
referencedMBeanClassName = mbeanClassName;
return;
| public boolean | isReadable()Returns read access mode for the role (true if it is readable).
return isReadable;
| public boolean | isWritable()Returns write access mode for the role (true if it is writable).
return isWritable;
| private void | readObject(java.io.ObjectInputStream in)Deserializes a {@link RoleInfo} from an {@link ObjectInputStream}.
if (compat)
{
// Read an object serialized in the old serial form
//
ObjectInputStream.GetField fields = in.readFields();
name = (String) fields.get("myName", null);
if (fields.defaulted("myName"))
{
throw new NullPointerException("myName");
}
isReadable = fields.get("myIsReadableFlg", false);
if (fields.defaulted("myIsReadableFlg"))
{
throw new NullPointerException("myIsReadableFlg");
}
isWritable = fields.get("myIsWritableFlg", false);
if (fields.defaulted("myIsWritableFlg"))
{
throw new NullPointerException("myIsWritableFlg");
}
description = (String) fields.get("myDescription", null);
if (fields.defaulted("myDescription"))
{
throw new NullPointerException("myDescription");
}
minDegree = fields.get("myMinDegree", (int)0);
if (fields.defaulted("myMinDegree"))
{
throw new NullPointerException("myMinDegree");
}
maxDegree = fields.get("myMaxDegree", (int)0);
if (fields.defaulted("myMaxDegree"))
{
throw new NullPointerException("myMaxDegree");
}
referencedMBeanClassName = (String) fields.get("myRefMBeanClassName", null);
if (fields.defaulted("myRefMBeanClassName"))
{
throw new NullPointerException("myRefMBeanClassName");
}
}
else
{
// Read an object serialized in the new serial form
//
in.defaultReadObject();
}
| public java.lang.String | toString()Returns a string describing the role info.
StringBuffer result = new StringBuffer();
result.append("role info name: " + name);
result.append("; isReadable: " + isReadable);
result.append("; isWritable: " + isWritable);
result.append("; description: " + description);
result.append("; minimum degree: " + minDegree);
result.append("; maximum degree: " + maxDegree);
result.append("; MBean class: " + referencedMBeanClassName);
return result.toString();
| private void | writeObject(java.io.ObjectOutputStream out)Serializes a {@link RoleInfo} to an {@link ObjectOutputStream}.
if (compat)
{
// Serializes this instance in the old serial form
//
ObjectOutputStream.PutField fields = out.putFields();
fields.put("myName", name);
fields.put("myIsReadableFlg", isReadable);
fields.put("myIsWritableFlg", isWritable);
fields.put("myDescription", description);
fields.put("myMinDegree", minDegree);
fields.put("myMaxDegree", maxDegree);
fields.put("myRefMBeanClassName", referencedMBeanClassName);
out.writeFields();
}
else
{
// Serializes this instance in the new serial form
//
out.defaultWriteObject();
}
|
|