jeremias 2003/01/27 01:24:04 Modified: src/org/apache/fop/area Area.java Log: Added convenience method to get a trait as an int. Revision Changes Path 1.15 +18 -1 xml-fop/src/org/apache/fop/area/Area.java Index: Area.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/area/Area.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Area.java 29 Nov 2002 23:18:52 -0000 1.14 +++ Area.java 27 Jan 2003 09:24:04 -0000 1.15 @@ -201,5 +201,22 @@ public Object getTrait(Object oTraitCode) { return (props != null ? props.get(oTraitCode) : null); } + + /** + * Get a trait from this area as an integer. + * + * @param oTraitCode the trait key + * @return the trait value + */ + public int getTraitAsInteger(Object oTraitCode) { + final Object obj = getTrait(oTraitCode); + if (obj instanceof Integer) { + return ((Integer)obj).intValue(); + } else { + throw new IllegalArgumentException("Trait " + + oTraitCode.getClass().getName() + + " could not be converted to an integer"); + } + } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]