Class AttributeType

java.lang.Object
com.vividsolutions.jump.feature.AttributeType
All Implemented Interfaces:
Serializable

public class AttributeType extends Object implements Serializable
Types of attributes
Since:
1.0
See Also:
  • Field Details

  • Constructor Details

    • AttributeType

      protected AttributeType(String name, Class<?> javaClass)
      Parameters:
      name - of the new AttributeType
      javaClass - java class used to store attributes of this type
    • AttributeType

      @Deprecated public AttributeType(String name)
      Deprecated.
      Parameters:
      name - of this new AttributeType
  • Method Details

    • allTypes

      public static Collection<AttributeType> allTypes()
      Returns:
      all AttributeTypes defined in that class.
    • basicTypes

      public static Collection<AttributeType> basicTypes()
      Returns:
      AttributeTypes currently used through OpenJUMP user interface
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toAttributeType

      public static AttributeType toAttributeType(String name)
      Converts a type name to an AttributeType.
      Parameters:
      name - the name of the AttributeType to retrieve
      Returns:
      the corresponding AttributeType
    • toJavaClass

      public Class<?> toJavaClass()
      Returns:
      the java class used to store attributes of this type.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toAttributeType

      public static AttributeType toAttributeType(Class<?> javaClass)
      Gets the first attribute type related with a given class. Tries the basic types first.
      Parameters:
      javaClass - the javaClass to retrieve
      Returns:
      an AttributeType based on this java class
    • getName

      public String getName()
      Returns:
      the name of this AtributeType.
    • areCompatibleTypes

      public static boolean areCompatibleTypes(AttributeType attrType1, AttributeType attrType2)
      Checks if two attribute types are compatible.
    • isNumeric

      public static boolean isNumeric(AttributeType type)
      Checks if an attribute type is numeric
      Parameters:
      type - the AttributeType
      Returns:
      true if type uses a java class implementing Number to store attribute values.
    • isNumericWithoutDecimal

      public static boolean isNumericWithoutDecimal(AttributeType type)
      Checks if an attribute type is numeric without any decimal
      Parameters:
      type - the AttributeType
      Returns:
      true if type uses an Integer or a Long to store attribute values
    • isDate

      public static boolean isDate(AttributeType type)
      Checks if an attribute type is a date
      Parameters:
      type - the AttributeType
      Returns:
      true if type uses a java.util.Date to store attribute values
    • isString

      public static boolean isString(AttributeType type)
      Checks if an attribute type is assignable to a String
      Parameters:
      type - the AttributeType
      Returns:
      true if type uses a java String to store attribute values
    • isBoolean

      public static boolean isBoolean(AttributeType type)
      Checks if an attribute type is assignable to a boolean
      Parameters:
      type - the AttributeType
      Returns:
      true if type uses a java Boolean to store attribute values.