/** * Gets the plural attriute. * * @param paramName * the param name * @return the plural attriute */ private PluralAttribute<? super X, ?, ?> getPluralAttriute(String paramName) { if (superClazzType != null) { return ((AbstractManagedType<? super X>) superClazzType).getDeclaredPluralAttribute(paramName); } return null; }
@Override public CollectionAttribute<X, ?> getDeclaredCollection(String paramName) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isCollectionAttribute(declaredAttrib)) { return (CollectionAttribute<X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public MapAttribute<X, ?, ?> getDeclaredMap(String paramName) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isMapAttribute(declaredAttrib)) { return (MapAttribute<X, ?, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public <E> CollectionAttribute<X, E> getDeclaredCollection(String paramString, Class<E> paramClass) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramString); if (onCheckCollectionAttribute(declaredAttrib, paramClass)) { return (CollectionAttribute<X, E>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramString + " , type:" + paramClass); }
@Override public <E> SetAttribute<X, E> getDeclaredSet(String paramName, Class<E> paramClass) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckSetAttribute(declaredAttrib, paramClass)) { return (SetAttribute<X, E>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName + " , type:" + paramClass); }
@Override public SetAttribute<X, ?> getDeclaredSet(String paramName) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public <E> ListAttribute<X, E> getDeclaredList(String paramName, Class<E> paramClass) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckListAttribute(declaredAttrib, paramClass)) { return (ListAttribute<X, E>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName + " , type:" + paramClass); }
@Override public ListAttribute<X, ?> getDeclaredList(String paramName) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isListAttribute(declaredAttrib)) { return (ListAttribute<X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public <K, V> MapAttribute<X, K, V> getDeclaredMap(String paramName, Class<K> keyClazz, Class<V> valueClazz) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckMapAttribute(declaredAttrib, valueClazz)) { if (valueClazz != null && valueClazz.equals(((MapAttribute<X, K, V>) declaredAttrib).getKeyJavaType())) { return (MapAttribute<X, K, V>) declaredAttrib; } } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed MapAttribute type, for name:" + paramName + " , value type:" + valueClazz + "key tpye:" + keyClazz); }
@Override public SetAttribute<? super X, ?> getSet(String paramName) { PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; } declaredAttrib = getPluralAttriute(paramName); if (isSetAttribute(declaredAttrib)) { return (SetAttribute<X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public ListAttribute<? super X, ?> getList(String paramName) { PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isListAttribute(declaredAttrib)) { return (ListAttribute<X, ?>) declaredAttrib; } declaredAttrib = getPluralAttriute(paramName); if (isListAttribute(declaredAttrib)) { return (ListAttribute<X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public CollectionAttribute<? super X, ?> getCollection(String paramName) { PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isCollectionAttribute(declaredAttrib)) { return (CollectionAttribute<X, ?>) declaredAttrib; } declaredAttrib = getPluralAttriute(paramName); if (isCollectionAttribute(declaredAttrib)) { return (CollectionAttribute<? super X, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public MapAttribute<? super X, ?, ?> getMap(String paramName) { PluralAttribute<? super X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (isMapAttribute(declaredAttrib)) { return (MapAttribute<X, ?, ?>) declaredAttrib; } declaredAttrib = getPluralAttriute(paramName); if (isMapAttribute(declaredAttrib)) { return (MapAttribute<X, ?, ?>) declaredAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName); }
@Override public <E> SetAttribute<? super X, E> getSet(String paramName, Class<E> paramClass) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckSetAttribute(declaredAttrib, paramClass)) { return (SetAttribute<X, E>) declaredAttrib; } PluralAttribute<? super X, ?, ?> superAttrib = getPluralAttriute(paramName); if (onCheckSetAttribute(superAttrib, paramClass)) { return (SetAttribute<? super X, E>) superAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName + " , type:" + paramClass); }
@Override public <E> ListAttribute<? super X, E> getList(String paramName, Class<E> paramClass) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckListAttribute(declaredAttrib, paramClass)) { return (ListAttribute<X, E>) declaredAttrib; } PluralAttribute<? super X, ?, ?> superAttrib = getPluralAttriute(paramName); if (onCheckListAttribute(superAttrib, paramClass)) { return (ListAttribute<? super X, E>) superAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName + " , type:" + paramClass); }
/** * Gets the declared attribute. * * @param paramName * the param name * @param checkValidity * the check validity * @return the declared attribute */ private Attribute<X, ?> getDeclaredAttribute(String paramName, boolean checkValidity) { Attribute<X, ?> attribute = (Attribute<X, ?>) getSingularAttribute(paramName, false); if (attribute == null) { attribute = (Attribute<X, ?>) getDeclaredPluralAttribute(paramName); } if (checkValidity) { checkForValid(paramName, attribute); } return attribute; }
@SuppressWarnings("unchecked") @Override public <E> CollectionAttribute<? super X, E> getCollection(String paramName, Class<E> paramClass) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckCollectionAttribute(declaredAttrib, paramClass)) { return (CollectionAttribute<X, E>) declaredAttrib; } PluralAttribute<? super X, ?, ?> superAttrib = getPluralAttriute(paramName); if (onCheckCollectionAttribute(superAttrib, paramClass)) { return (CollectionAttribute<? super X, E>) superAttrib; } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed type, for name:" + paramName + " , type:" + paramClass); }
@Override public <K, V> MapAttribute<? super X, K, V> getMap(String paramName, Class<K> keyClazz, Class<V> valueClazz) { PluralAttribute<X, ?, ?> declaredAttrib = getDeclaredPluralAttribute(paramName); if (onCheckMapAttribute(declaredAttrib, valueClazz)) { if (valueClazz != null && valueClazz.equals(((MapAttribute<X, K, V>) declaredAttrib).getKeyJavaType())) { return (MapAttribute<X, K, V>) declaredAttrib; } } PluralAttribute<? super X, ?, ?> superAttrib = getPluralAttriute(paramName); if (onCheckMapAttribute(superAttrib, valueClazz)) { if (valueClazz != null && valueClazz.equals(((MapAttribute<? super X, K, V>) superAttrib).getKeyJavaType())) { return (MapAttribute<? super X, K, V>) superAttrib; } } throw new IllegalArgumentException( "attribute of the given name and type is not present in the managed MapAttribute type, for name:" + paramName + " , value type:" + valueClazz + "key tpye:" + keyClazz); }