|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deduced.xml.DeducedXmlUtilities
public class DeducedXmlUtilities
Deduced Xml Utility methods
Field Summary | |
---|---|
static java.util.logging.Logger |
LOGGER
logger |
Constructor Summary | |
---|---|
DeducedXmlUtilities()
|
Method Summary | |
---|---|
private static void |
appendErrorMessage(java.lang.StringBuilder messageBuilder,
int errorIndex,
DecodeException currentError)
append Error Message |
private static java.lang.String |
buildMultipleDecodeExceptionMessage(java.util.List<DecodeException> errorList)
build the exception message |
static java.lang.Object |
createBasicType(java.lang.String className,
java.lang.String value,
PropertyCollection<?,?> instance)
Create a basic object type (such as boolean, float, int) from the Specified class name or property instance. |
private static boolean |
isCalendarClass(java.lang.String className)
check if a class name is a calendar |
private static java.lang.Boolean |
parseBoolean(java.lang.String value)
parse a Boolean. |
private static java.util.Calendar |
parseCalendar(java.lang.String value)
read a Calendar from a string. |
private static java.lang.Character |
parseCharacter(java.lang.String value)
parse a string containing a single character |
private static java.lang.Object |
parseNumberFromClassName(java.lang.String className,
java.lang.String value)
parse Number From Class Name |
private static java.lang.Object |
parseNumericType(PropertyCollection<?,?> valueType,
java.lang.String value)
parse Numeric Type |
static java.lang.Object |
parseStringValueFromClassName(java.lang.String className,
java.lang.String value)
parse a string to create a basic type based on it's class name |
static java.lang.Object |
parseStringValueFromInstance(PropertyCollection<?,?> instance,
java.lang.String value)
read a basic type value from the property instance description |
static java.lang.Object |
parseStringValueFromType(PropertyCollection<?,?> valueType,
java.lang.String value)
parse a basic type value from the property type description |
static PropertyCollection<?,?> |
readModelLayer(java.lang.String fileName,
PropertyCollection<?,?> modelLayerToRead,
PropertyCollection<?,?> applicationModel,
boolean ignoreErrors)
Utility method to read a model layer from a XML file. |
static DecodeException |
regroupMultipleDecodeException(java.util.List<DecodeException> errorList)
create a Decode Exception that regroup many exceptions into one. |
static void |
writeModelLayer(java.lang.String fileName,
PropertyCollection<?,?> objectToSave,
PropertyCollection<?,?> hub)
save a Model Layer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.util.logging.Logger LOGGER
Constructor Detail |
---|
public DeducedXmlUtilities()
Method Detail |
---|
public static PropertyCollection<?,?> readModelLayer(java.lang.String fileName, PropertyCollection<?,?> modelLayerToRead, PropertyCollection<?,?> applicationModel, boolean ignoreErrors) throws java.lang.Exception
fileName
- the file name to load.modelLayerToRead
- the model layer to load. If null is specified,
the XML Parser will attempt to create the root object to load.
If this parameter isn't null and an error occurs during the
load process, it is possible that this model layer will
contain a partially loaded model.applicationModel
- the application model used to find dependenciesignoreErrors
- if set to true, non-fatal loading errors will be
ignored while parsing the XML file. Otherwise an exception
will be thrown when non-fatal errors are encountered
java.io.IOException
- any IO exception encountered while reading
the file
DecodeException
- any decoding exception encountered. If the flag
ignoreErrors is set to true, then only fatal decoding
exceptions will be thrown. Non-fatal one will be hidden.
java.lang.Exception
- any other decoding exception.public static DecodeException regroupMultipleDecodeException(java.util.List<DecodeException> errorList)
errorList
- the error list
private static java.lang.String buildMultipleDecodeExceptionMessage(java.util.List<DecodeException> errorList)
errorList
- the error list to use
private static void appendErrorMessage(java.lang.StringBuilder messageBuilder, int errorIndex, DecodeException currentError)
messageBuilder
- the message builder to append toerrorIndex
- the error index, starting in range 1..*currentError
- the error to appendpublic static void writeModelLayer(java.lang.String fileName, PropertyCollection<?,?> objectToSave, PropertyCollection<?,?> hub) throws java.lang.Exception
fileName
- the file name to save toobjectToSave
- the model to savehub
- the application hub used to extract references
java.lang.Exception
- any error encountered while writing the XML File.
Typical errors include @ encoding or IO exception occurspublic static java.lang.Object createBasicType(java.lang.String className, java.lang.String value, PropertyCollection<?,?> instance) throws DecodeException
className
- the class name of the typevalue
- the string valueinstance
- the property instance that describes this value
DecodeException
- any error that occurred during the value decodingpublic static java.lang.Object parseStringValueFromClassName(java.lang.String className, java.lang.String value) throws DecodeException
className
- the class namevalue
- the string value of the object
DecodeException
- if the parse operation failsprivate static java.lang.Object parseNumberFromClassName(java.lang.String className, java.lang.String value)
className
- the class namevalue
- the value to parse
private static java.lang.Boolean parseBoolean(java.lang.String value)
value
- the string value
java.lang.IllegalArgumentException
- if the value doesn't contain the right
boolean value string.private static java.lang.Character parseCharacter(java.lang.String value)
value
- the string value
private static boolean isCalendarClass(java.lang.String className)
className
- the class name
public static java.lang.Object parseStringValueFromInstance(PropertyCollection<?,?> instance, java.lang.String value) throws DecodeException
instance
- the property instancevalue
- the string value
DecodeException
- if the parse operation failedpublic static java.lang.Object parseStringValueFromType(PropertyCollection<?,?> valueType, java.lang.String value) throws DecodeException
valueType
- the property typevalue
- the string value
DecodeException
- if the parse operation failedprivate static java.lang.Object parseNumericType(PropertyCollection<?,?> valueType, java.lang.String value)
valueType
- the value typevalue
- the actual value
private static java.util.Calendar parseCalendar(java.lang.String value)
value
- the string value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |