public PluralAttributePath( CriteriaBuilderImpl criteriaBuilder, PathSource source, PluralAttribute<?,X,?> attribute) { super( criteriaBuilder, attribute.getJavaType(), source ); this.attribute = attribute; this.persister = resolvePersister( criteriaBuilder, attribute ); }
String returnType = Type.getMethodDescriptor(Type.getType(pluralAttrib.getJavaType()));
public PluralAttributePath(BlazeCriteriaBuilderImpl criteriaBuilder, AbstractPath<?> source, PluralAttribute<?, X, ?> attribute) { super(criteriaBuilder, attribute.getJavaType(), source); this.attribute = attribute; }
@Override public Class<? extends X> getJavaType() { return this.attribute.getJavaType(); }
public PluralAttributePath(BlazeCriteriaBuilderImpl criteriaBuilder, AbstractPath<?> source, PluralAttribute<?, X, ?> attribute) { super(criteriaBuilder, attribute.getJavaType(), source); this.attribute = attribute; }
public PluralAttributePath( CriteriaBuilderImpl criteriaBuilder, PathSource source, PluralAttribute<?,X,?> attribute) { super( criteriaBuilder, attribute.getJavaType(), source ); this.attribute = attribute; this.persister = resolvePersister( criteriaBuilder, attribute ); }
public <E, C extends Collection<E>> Expression<C> get(PluralAttribute<X, C, E> attr) { return new PathImpl<X,C>(this, (PluralAttributeImpl<? super X, C, E>)attr, attr.getJavaType()); }
private Statement generateCreateEmptyCollectionMethod(Object sourceObject) { PluralAttribute<?, ?, ?> attr = (PluralAttribute<?, ?, ?>) sourceObject; Class<?> declaredCollectionType = attr.getJavaType(); Class<?> collectionTypeToInstantiate; if (!declaredCollectionType.isInterface()) { collectionTypeToInstantiate = declaredCollectionType; } else if (List.class.isAssignableFrom(declaredCollectionType)) { collectionTypeToInstantiate = ArrayList.class; } else if (Set.class.isAssignableFrom(declaredCollectionType)) { collectionTypeToInstantiate = HashSet.class; } else if (OrderedMap.class.isAssignableFrom(declaredCollectionType)) { collectionTypeToInstantiate = LinkedHashMap.class; } else if (Map.class.isAssignableFrom(declaredCollectionType)) { collectionTypeToInstantiate = HashMap.class; } else if (Collection.class.isAssignableFrom(declaredCollectionType)) { collectionTypeToInstantiate = ArrayList.class; } else { throw new RuntimeException("Don't know how to instantiate a collection of " + declaredCollectionType); } return Stmt.nestedCall(Stmt.newObject(collectionTypeToInstantiate)).returnValue(); }
public JPACollectionType(PluralAttribute<?,?,?> collection, SecureEntity secureEntity) { super(collection.getName(), collection.getJavaType(), collection.getElementType().getJavaType(), secureEntity); String relName = StringUtilities.singularize(collection.getName()); this.idsFieldDefinition = new FieldDefinition( relName + AdaptrexEntityType.COLLECTION_IDS_NAME, ExtTypeFormatter.AUTO ); String capName = StringUtilities.capitalize(getName()); Class<?> declaringClass = collection.getDeclaringType().getJavaType(); try { getter = declaringClass.getMethod("get" + capName); } catch (Exception e) {} if (getter == null) return; try { setter = declaringClass.getMethod("set" + capName, getter.getReturnType()); } catch (Exception e) {} }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }
/** * Gets a new path that represents the given multi-valued attribute from this path. */ public <E, C extends java.util.Collection<E>> Expression<C> get(PluralAttribute<X, C, E> coll) { if (getType() != coll.getDeclaringType()) { coll = (PluralAttribute)((ManagedType)getType()).getAttribute(coll.getName()); } return new PathImpl<X,C>(this, (Members.PluralAttributeImpl<? super X, C, E>)coll, coll.getJavaType()); }
private Type<?> getType(Type<?> baseType, Attribute<?, ?> attribute) { if (attribute instanceof PluralAttribute<?, ?, ?>) { return metamodel.type(((PluralAttribute<?, ?, ?>) attribute).getJavaType()); } Class<?> baseClass = baseType.getJavaType(); if (baseClass != null) { Class<?> clazz = JpaMetamodelUtils.resolveFieldClass(baseType.getJavaType(), attribute); if (clazz != null) { return metamodel.type(clazz); } } return ((SingularAttribute<?, ?>) attribute).getType(); }
private Type<?> getType(Type<?> baseType, Attribute<?, ?> attribute) { if (attribute instanceof PluralAttribute<?, ?, ?>) { return metamodel.type(((PluralAttribute<?, ?, ?>) attribute).getJavaType()); } Class<?> baseClass = baseType.getJavaType(); if (baseClass != null) { Class<?> clazz = JpaMetamodelUtils.resolveFieldClass(baseType.getJavaType(), attribute); if (clazz != null) { return metamodel.type(clazz); } } return ((SingularAttribute<?, ?>) attribute).getType(); }