|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.jdo.impl.enhancer.meta.prop.MetaDataProperties
This class parses properties containing meta data information about classes. The syntax of the properties is the following:
test.Test1#field, the keys test.Test1 and
test.Test1#Field have to be present.
| Nested Class Summary | |
private static interface |
MetaDataProperties.Msg
Holds all unformatted error messages. |
private static class |
MetaDataProperties.Property
The holder-class for the name and the value of a property. |
| Field Summary | |
(package private) static java.lang.String |
ACCESS_PACKAGE_LOCAL
|
(package private) static java.lang.String |
ACCESS_PRIVATE
|
(package private) static java.lang.String |
ACCESS_PROTECTED
|
(package private) static java.lang.String |
ACCESS_PUBLIC
|
(package private) static java.lang.String |
ANNOTATION_TYPE_DFG
|
(package private) static java.lang.String |
ANNOTATION_TYPE_KEY
|
(package private) static java.lang.String |
ANNOTATION_TYPE_MEDIATED
|
private java.util.Map |
cachedJDOClasses
A map of already read class properties. |
(package private) static char |
FIELD_DELIMITER
The delimiter of a property key between the class- and fieldname. |
(package private) static java.lang.String |
JDO_PERSISTENT
|
(package private) static java.lang.String |
JDO_TRANSACTIONAL
|
(package private) static java.lang.String |
JDO_TRANSIENT
|
private static JDOClass |
NULL
A constant for the cache indicating that a given classname if not specified in the properties. |
private java.util.Properties |
properties
The properties to parse. |
(package private) static java.lang.String |
PROPERTY_ACCESS_MODIFIER
|
(package private) static java.lang.String |
PROPERTY_ANNOTATION_TYPE
|
(package private) static char |
PROPERTY_ASSIGNER
A delimiter character between attribute name and attribute value |
(package private) static java.lang.String |
PROPERTY_DELIMITERS
A string of delimiter characters between attributes. |
(package private) static java.lang.String |
PROPERTY_JDO_MODIFIER
|
(package private) static java.lang.String |
PROPERTY_OID_CLASSNAME
|
(package private) static java.lang.String |
PROPERTY_SUPER_CLASSNAME
|
(package private) static java.lang.String |
PROPERTY_TYPE
|
private java.util.List |
tmpTokens
A temporary vector (this is the reason why the implementation is not thread safe). |
| Constructor Summary | |
MetaDataProperties(java.util.Properties props)
Creates a new object with the given properties. |
|
| Method Summary | |
private static void |
checkForDuplicateProperties(java.util.List props,
java.lang.String entry)
Checks if an attribute-property was entered twice for a class or field. |
private static void |
checkPropertyName(java.lang.String name,
java.lang.String[] validnames,
java.lang.String entry)
Checks if an attribute name is recognized by the parser. |
private static void |
checkPropertyValue(MetaDataProperties.Property prop,
java.lang.String[] validvalues,
java.lang.String name,
java.lang.String entry)
Checks if the given value of an attribute-property is recognized by by the parser if that value belongs to a given attribute name. |
JDOClass |
getJDOClass(java.lang.String classname)
Get the information about the class with the given name. |
JDOField |
getJDOField(java.lang.String fieldname,
java.lang.String classname)
Gets the information about the specified field. |
java.lang.String[] |
getKnownClassNames()
Gets all classnames in the properties. |
private static int |
getModifiers(java.lang.String modifier)
Returns the modifier value for a Java modifier name. |
(package private) static java.lang.String |
getMsg(java.lang.String msg,
java.lang.String[] params)
Formats an error message with the given parameters. |
static void |
main(java.lang.String[] argv)
A simple test to run from the command line. |
private JDOClass |
parseJDOClass(java.lang.String classname,
java.lang.String attributes)
Parses the attributes-string of a class and puts them into a JDOClass-object. |
private JDOField |
parseJDOField(java.lang.String attributes,
java.lang.String fieldname,
JDOClass clazz)
Parses the attribute-string of a field. |
private void |
parseJDOFields(JDOClass clazz)
Parses all fields of a given class. |
(package private) java.util.List |
parseProperties(java.lang.String attributes)
Parses the attribute-string of a class- or fieldname. |
private MetaDataProperties.Property |
parseProperty(java.lang.String attribute)
Parses the given attribute and splits it into name and value. |
private static void |
validateClassProperty(MetaDataProperties.Property prop,
java.lang.String classname)
Checks if the given attribute-property of a class is valid. |
private void |
validateDependencies(JDOClass clazz)
Validates dependencies between a class and its fields and between. |
private static void |
validateFieldName(java.lang.String fieldname,
java.lang.String classname)
Checks if a given fieldname is a valid Java identifier. |
private void |
validateFieldProperty(MetaDataProperties.Property prop,
java.lang.String fieldname,
java.lang.String classname)
Checks if the given attribute-property if valid for a field. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
static final char FIELD_DELIMITER
static final java.lang.String PROPERTY_DELIMITERS
static final char PROPERTY_ASSIGNER
static final java.lang.String PROPERTY_ACCESS_MODIFIER
static final java.lang.String PROPERTY_JDO_MODIFIER
static final java.lang.String PROPERTY_SUPER_CLASSNAME
static final java.lang.String PROPERTY_OID_CLASSNAME
static final java.lang.String PROPERTY_TYPE
static final java.lang.String PROPERTY_ANNOTATION_TYPE
static final java.lang.String ACCESS_PRIVATE
static final java.lang.String ACCESS_PACKAGE_LOCAL
static final java.lang.String ACCESS_PROTECTED
static final java.lang.String ACCESS_PUBLIC
static final java.lang.String JDO_TRANSIENT
static final java.lang.String JDO_PERSISTENT
static final java.lang.String JDO_TRANSACTIONAL
static final java.lang.String ANNOTATION_TYPE_KEY
static final java.lang.String ANNOTATION_TYPE_DFG
static final java.lang.String ANNOTATION_TYPE_MEDIATED
private java.util.Properties properties
private final java.util.Map cachedJDOClasses
JDOClass-object.
private static final JDOClass NULL
private final java.util.List tmpTokens
| Constructor Detail |
public MetaDataProperties(java.util.Properties props)
props - The properties.| Method Detail |
public final JDOClass getJDOClass(java.lang.String classname)
throws EnhancerMetaDataUserException
classname - The classname.
null if no
information is given.
EnhancerMetaDataUserException - If something went wrong parsing
the properties.
public final JDOField getJDOField(java.lang.String fieldname,
java.lang.String classname)
throws EnhancerMetaDataUserException
classname - The name of the class.fieldname - The name of the field of the class.
null if
no information could be found.
EnhancerMetaDataUserException - If something went wrong parsing
the properties.public final java.lang.String[] getKnownClassNames()
private final JDOClass parseJDOClass(java.lang.String classname,
java.lang.String attributes)
throws EnhancerMetaDataUserException
JDOClass-object.
classname - The name of the class.attributes - The attribute-string as specified in the properties.
JDOClass-object.
EnhancerMetaDataUserException - If something went wrong parsing
the attributes.
private static void validateClassProperty(MetaDataProperties.Property prop,
java.lang.String classname)
throws EnhancerMetaDataUserException
prop - The attribute-property.classname - The classname.
EnhancerMetaDataUserException - If the validation failed.
private final void parseJDOFields(JDOClass clazz)
throws EnhancerMetaDataUserException
clazz - the representation of the class
EnhancerMetaDataUserException - on parse errors
private final JDOField parseJDOField(java.lang.String attributes,
java.lang.String fieldname,
JDOClass clazz)
throws EnhancerMetaDataUserException
attributes - The attribute-string.fieldname - The fieldname.clazz - The class to field belongs to.
EnhancerMetaDataUserException - on parse errors
private final void validateFieldProperty(MetaDataProperties.Property prop,
java.lang.String fieldname,
java.lang.String classname)
throws EnhancerMetaDataUserException
prop - The attribute-property.fieldname - The fieldname.classname - The classname.
EnhancerMetaDataUserException - If the check fails.
private final void validateDependencies(JDOClass clazz)
throws EnhancerMetaDataUserException
clazz - the class
EnhancerMetaDataUserException - if the validation fails
private static void validateFieldName(java.lang.String fieldname,
java.lang.String classname)
throws EnhancerMetaDataUserException
fieldname - The fieldname.classname - The corresponding classname.
EnhancerMetaDataUserException - If the check fails.
private static void checkForDuplicateProperties(java.util.List props,
java.lang.String entry)
throws EnhancerMetaDataUserException
props - The properties.entry - The class- or fieldname.
EnhancerMetaDataUserException - If the check fails.
private static void checkPropertyName(java.lang.String name,
java.lang.String[] validnames,
java.lang.String entry)
throws EnhancerMetaDataUserException
name - The name of the attribute.validnames - A list of valid names(the attribute name has to
be in this list).entry - The class- or fieldname.
EnhancerMetaDataUserException - If the check fails.
private static void checkPropertyValue(MetaDataProperties.Property prop,
java.lang.String[] validvalues,
java.lang.String name,
java.lang.String entry)
throws EnhancerMetaDataUserException
prop - The attribute-property(with name and value).validvalues - A list of valid values.name - The name of the attribute-property to check.entry - The class- or fieldname.
EnhancerMetaDataUserException - If the check fails.
static final java.lang.String getMsg(java.lang.String msg,
java.lang.String[] params)
msg - The message with format strings.params - The params to format the message with.
final java.util.List parseProperties(java.lang.String attributes)
throws EnhancerMetaDataUserException
attributes - The attribute-string.
Propert<-objects for the attributes.
EnhancerMetaDataUserException - If the parsing fails.
private final MetaDataProperties.Property parseProperty(java.lang.String attribute)
throws EnhancerMetaDataUserException
attribute - The attribute-string.
Propert-object.
EnhancerMetaDataUserException - If the parsing fails.private static int getModifiers(java.lang.String modifier)
public static void main(java.lang.String[] argv)
argv - The command line arguments.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||