From 9a66281d109bbef8e1c99759d817bfb58843842c Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 24 Sep 2007 16:14:18 +0000 Subject: [PATCH] test for property type and property type constants git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@475 be28352e-c001-0410-b1a7-c7978e42abec --- src/uk/ac/vamsas/objects/utils/Properties.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/uk/ac/vamsas/objects/utils/Properties.java b/src/uk/ac/vamsas/objects/utils/Properties.java index 491a781..c7d9e30 100644 --- a/src/uk/ac/vamsas/objects/utils/Properties.java +++ b/src/uk/ac/vamsas/objects/utils/Properties.java @@ -13,9 +13,28 @@ public class Properties { } else { - vProperty.setType("String"); + vProperty.setType(STRINGTYPE); } vProperty.setContent(content); return vProperty; } + public static String STRINGTYPE="string"; + public static String FLOATTYPE="float"; + public static String INTEGERTYPE="integer"; + + public boolean isString(Property p) + { + return isType(p, STRINGTYPE); + } + + /** + * + * @param p the property to test for type + * @param typeString one of the string constants in this class + * @return true if p is of type 'typeString' + */ + public boolean isType(Property p, String typeString) { + return (p==null) ? false : (p.getType().toLowerCase().equals(typeString)); + } + } -- 1.7.10.2