From: jprocter Date: Mon, 24 Sep 2007 16:14:18 +0000 (+0000) Subject: test for property type and property type constants X-Git-Tag: Release_0.2~45 X-Git-Url: http://source.jalview.org/gitweb/?p=vamsas.git;a=commitdiff_plain;h=9a66281d109bbef8e1c99759d817bfb58843842c 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 --- 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)); + } + }