@Override public Object get(Object key) { if (key instanceof String) { return maybeGet((String) key); } else { return null; } }
/** * {@inheritDoc} * * This implementation delegates to {@link #maybeGet(String)}. */ @Nonnull @Override public Object get(String attr) { Object val = maybeGet(attr); if (val == null) { throw new NoSuchAttributeException(attr); } else { return val; } }
/** * {@inheritDoc} * * This implementation delegates to {@link #hasAttribute(String)} */ @Override public boolean hasAttribute(TypedName<?> name) { Object value = maybeGet(name.getName()); return value != null && name.getRawType().isInstance(value); }
/** * {@inheritDoc} * * This implementation delegates to {@link #maybeGet(String)} and checks the type. */ @Nullable @Override public <T> T maybeGet(TypedName<T> name) { try { // FIXME This is not fully type-safe! return (T) name.getRawType().cast(maybeGet(name.getName())); } catch (ClassCastException e) { throw new IllegalArgumentException(e); } }
/** * {@inheritDoc} * * This implementation delegates to {@link #maybeGet(TypedName)}. */ @Nonnull @Override public <T> T get(TypedName<T> name) { T val = maybeGet(name); if (val == null) { throw new NoSuchAttributeException(name.toString()); } else { return val; } }
@Override public Object get(Object key) { if (key instanceof String) { return maybeGet((String) key); } else { return null; } }
/** * {@inheritDoc} * * This implementation delegates to {@link #maybeGet(String)}. */ @Nonnull @Override public Object get(String attr) { Object val = maybeGet(attr); if (val == null) { throw new NoSuchAttributeException(attr); } else { return val; } }
/** * {@inheritDoc} * * This implementation delegates to {@link #hasAttribute(String)} */ @Override public boolean hasAttribute(TypedName<?> name) { Object value = maybeGet(name.getName()); return value != null && name.getRawType().isInstance(value); }
/** * {@inheritDoc} * * This implementation delegates to {@link #maybeGet(String)} and checks the type. */ @Nullable @Override public <T> T maybeGet(TypedName<T> name) { try { // FIXME This is not fully type-safe! return (T) name.getRawType().cast(maybeGet(name.getName())); } catch (ClassCastException e) { throw new IllegalArgumentException(e); } }
/** * {@inheritDoc} * * This implementation delegates to {@link #maybeGet(TypedName)}. */ @Nonnull @Override public <T> T get(TypedName<T> name) { T val = maybeGet(name); if (val == null) { throw new NoSuchAttributeException(name.toString()); } else { return val; } }