/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public String getLabel(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null && o instanceof CharSequence) return o.toString(); } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public Object[] getArray(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null && o instanceof Object[]) return ((Object[]) o); } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public Object[] getArray(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null && o instanceof Object[]) return ((Object[]) o); } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ // public Object getAttribute( String key, Class<?> clazz ) @SuppressWarnings("all") public <T> T getAttribute(String key, Class<T> clazz) { if (attributes != null) { Object o = attributes.get(key); if (o != null && clazz.isInstance(o)) return (T) o; } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public String getLabel(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null && o instanceof CharSequence) return o.toString(); } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ @SuppressWarnings("unchecked") public ArrayList<? extends Number> getVector(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null && o instanceof ArrayList) return ((ArrayList<? extends Number>) o); } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ @SuppressWarnings("unchecked") public ArrayList<? extends Number> getVector(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null && o instanceof ArrayList) return ((ArrayList<? extends Number>) o); } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ // public Object getAttribute( String key ) @SuppressWarnings("all") public <T> T getAttribute(String key) { if (attributes != null) { T value = (T) attributes.get(key); if (value != null) return value; } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ // public Object getAttribute( String key ) @SuppressWarnings("all") public <T> T getAttribute(String key) { if (attributes != null) { T value = (T) attributes.get(key); if (value != null) return value; } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n*m)) with n being the number of attributes of this * element and m the number of keys given. */ // public Object getFirstAttributeOf( Class<?> clazz, String ... keys ) @SuppressWarnings("all") public <T> T getFirstAttributeOf(Class<T> clazz, String... keys) { Object o = null; if (attributes == null) return null; for (String key : keys) { o = attributes.get(key); if (o != null && clazz.isInstance(o)) return (T) o; } if (nullAttributesAreErrors()) throw new NullAttributeException(); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ // public Object getAttribute( String key, Class<?> clazz ) @SuppressWarnings("all") public <T> T getAttribute(String key, Class<T> clazz) { if (attributes != null) { Object o = attributes.get(key); if (o != null && clazz.isInstance(o)) return (T) o; } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n*m)) with n being the number of attributes of this * element and m the number of keys given. */ // public Object getFirstAttributeOf( String ... keys ) @SuppressWarnings("all") public <T> T getFirstAttributeOf(String... keys) { Object o = null; if (attributes != null) { for (String key : keys) { o = attributes.get(key); if (o != null) return (T) o; } } if (o == null && nullAttributesAreErrors()) throw new NullAttributeException(); return (T) o; }
/** * @complexity O(log(n*m)) with n being the number of attributes of this * element and m the number of keys given. */ // public Object getFirstAttributeOf( Class<?> clazz, String ... keys ) @SuppressWarnings("all") public <T> T getFirstAttributeOf(Class<T> clazz, String... keys) { Object o = null; if (attributes == null) return null; for (String key : keys) { o = attributes.get(key); if (o != null && clazz.isInstance(o)) return (T) o; } if (nullAttributesAreErrors()) throw new NullAttributeException(); return null; }
/** * @complexity O(log(n*m)) with n being the number of attributes of this * element and m the number of keys given. */ // public Object getFirstAttributeOf( String ... keys ) @SuppressWarnings("all") public <T> T getFirstAttributeOf(String... keys) { Object o = null; if (attributes != null) { for (String key : keys) { o = attributes.get(key); if (o != null) return (T) o; } } if (o == null && nullAttributesAreErrors()) throw new NullAttributeException(); return (T) o; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public double getNumber(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null) { if (o instanceof Number) return ((Number) o).doubleValue(); if (o instanceof String) { try { return Double.parseDouble((String) o); } catch (NumberFormatException e) { } } else if (o instanceof CharSequence) { try { return Double .parseDouble(((CharSequence) o).toString()); } catch (NumberFormatException e) { } } } } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return Double.NaN; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public double getNumber(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null) { if (o instanceof Number) return ((Number) o).doubleValue(); if (o instanceof String) { try { return Double.parseDouble((String) o); } catch (NumberFormatException e) { } } else if (o instanceof CharSequence) { try { return Double .parseDouble(((CharSequence) o).toString()); } catch (NumberFormatException e) { } } } } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return Double.NaN; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public HashMap<?, ?> getHash(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null) { if (o instanceof HashMap<?, ?>) return ((HashMap<?, ?>) o); if (o instanceof CompoundAttribute) return ((CompoundAttribute) o).toHashMap(); } } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }
/** * @complexity O(log(n)) with n being the number of attributes of this * element. */ public HashMap<?, ?> getHash(String key) { if (attributes != null) { Object o = attributes.get(key); if (o != null) { if (o instanceof HashMap<?, ?>) return ((HashMap<?, ?>) o); if (o instanceof CompoundAttribute) return ((CompoundAttribute) o).toHashMap(); } } if (nullAttributesAreErrors()) throw new NullAttributeException(key); return null; }