微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javax.persistence.metamodel.Bindable的实例源码

项目:crnk-framework    文件QueryUtil.java   
public static boolean containsRelation(Object expr) {
    if (expr instanceof Join) {
        return true;
    } else if (expr instanceof Singularattribute) {
        Singularattribute<?,?> attr = (Singularattribute<?,?>) expr;
        return attr.isAssociation();
    } else if (expr instanceof Path) {
        Path<?> attrPath = (Path<?>) expr;
        Bindable<?> model = attrPath.getModel();
        Path<?> parent = attrPath.getParentPath();
        return containsRelation(parent) || containsRelation(model);
    } else {
        // we may can do better here...
        return false;
    }
}
项目:hibernate-semantic-query    文件Helper.java   
public static Type toType(Bindable bindable) {
    switch ( bindable.getBindableType() ) {
        case ENTITY_TYPE: {
            return (EntityType) bindable;
        }
        case SINGULAR_ATTRIBUTE: {
            return ( (Singularattribute) bindable ).getType();
        }
        case PLURAL_ATTRIBUTE: {
            return ( (PluralAttribute) bindable ).getElementType();
        }
        default: {
            throw new ParsingException( "Unexpected Bindable type : " + bindable );
        }
    }
}
项目:jpasearch    文件JpaUtil.java   
@SuppressWarnings("unchecked")
public <E,F> Path<F> getPath(Root<E> root,List<Attribute<?,?>> attributes) {
    Path<?> path = root;
    for (Attribute<?,?> attribute : attributes) {
        boolean found = false;
        if (path instanceof FetchParent) {
            for (Fetch<E,?> fetch : ((FetchParent<?,E>) path).getFetches()) {
                if (attribute.getName().equals(fetch.getAttribute().getName()) && (fetch instanceof Join<?,?>)) {
                    path = (Join<E,?>) fetch;
                    found = true;
                    break;
                }
            }
        }
        if (!found) {
            if ((attributes.indexOf(attribute) != (attributes.size() - 1)) && (attribute instanceof Bindable)
                    && Identifiable.class.isAssignableFrom(((Bindable<?>) attribute).getBindableJavaType()) && (path instanceof From)) {
                path = ((From<?,?>) path).join(attribute.getName(),JoinType.LEFT);
            } else {
                path = path.get(attribute.getName());
            }
        }
    }
    return (Path<F>) path;
}
项目:elrest-java    文件JPAFilterImpltest.java   
@Test
public void hibernatePluralPathtest() {
    CriteriaBuilder build = em.getCriteriaBuilder();
    CriteriaQuery<OnetoManyInstance> critQ = build.createquery(OnetoManyInstance.class);
    Root<OnetoManyInstance> resultRoot = critQ.from(OnetoManyInstance.class);
    Path pluralPath = resultRoot.get("many");
    Bindable shouldBePluralAttribute = pluralPath.getModel();
    assertNotNull(shouldBePluralAttribute);

    assertTrue(shouldBePluralAttribute instanceof PluralAttribute);
}
项目:katharsis-framework    文件QueryUtil.java   
public static boolean containsRelation(Object expr) {
  if (expr instanceof Join) {
    return true;
  }
  else if (expr instanceof Singularattribute) {
    Singularattribute<?,?>) expr;
    return attr.isAssociation();
  }
  else if (expr instanceof Path) {
    Path<?> attrPath = (Path<?>) expr;
    Bindable<?> model = attrPath.getModel();
    Path<?> parent = attrPath.getParentPath();
    return containsRelation(parent) || containsRelation(model);
  }
  else {
    // we may can do better here...
    return false;
  }
}
项目:jpasecurity    文件CriteriaEntityFilter.java   
private String getName(Bindable<?> bindable) {
    if (bindable.getBindableType() == BindableType.ENTITY_TYPE) {
        EntityType<?> entityType = (EntityType<?>)bindable;
        return entityType.getName();
    } else {
        Attribute<?,?> attribute = (Attribute<?,?>)bindable;
        return attribute.getName();
    }
}
项目:breeze.server.java    文件JPAMetadata.java   
/**
 * Get the Breeze name of the entity type. For collections,Breeze expects the name of the
 * element type.
 * 
 * @param propType
 * @return
 */
Class getEntityType(Attribute attr) {
    if (attr instanceof Bindable) {
        return ((Bindable)attr).getBindableJavaType();
    } else {
        throw new RuntimeException("Not Bindable: " + attr);
    }
}
项目:query-utils    文件ProjectionUtil.java   
static boolean isdistinctable(MetaJpaConstructor<?,?,?> projection,int columnIndex) {
    logger.debug("isdistinctable({},{})",projection,columnIndex);
    boolean ret = Bindable.class.isAssignableFrom(projection.getConstructorParameterTypes().get(columnIndex)) &&
                  !Notdistinctable.class.isAssignableFrom(((Bindable<?>)projection.getParameters().get(columnIndex)).getBindableJavaType()) ||
                  !Bindable.class.isAssignableFrom(projection.getConstructorParameterTypes().get(columnIndex)) &&
                  Notdistinctable.class.isAssignableFrom(projection.getParameters().get(columnIndex).getJavaType());
    logger.debug("isdistinctable -> {}",ret);
    return ret;
}
项目:query-utils    文件Embeddableutil.java   
static Object collectEmbeddableFromParts(metamodel metamodel,Bindable<?> attr,Iterable<Object> columns) {
    logger.debug("collectEmbeddableFromParts({},{},new Object[] {metamodel,attr,columns});
    List<Object> cols = newList(columns);
    List<? extends Attribute<?,?>> embeddableAttributes = getEmbeddableAttributes(attr,metamodel);
    if (embeddableAttributes.size() != cols.size()) {
        throw new IllegalStateException("Expected same size for: " + embeddableAttributes + "," + cols);
    }
    Class<?> embeddableClass = getEmbeddableType(attr,metamodel).getJavaType();
    try {
        Object ret = instantiate(embeddableClass);
        for (Tuple2<? extends Attribute<?,?>,Object> a: zip(embeddableAttributes,cols)) {
            Member member = a._1.getJavaMember();
            if (member instanceof Field) {
                Field f = (Field)member;
                f.setAccessible(true);
                f.set(ret,a._2);
            } else {
                Method m = (Method)member;
                if (m.getParameterTypes().length == 1 && head(m.getParameterTypes()).isAssignableFrom(a._1.getJavaType())) {
                    m.setAccessible(true);
                    m.invoke(ret,a._2);
                } else {
                    throw new UnsupportedOperationException("not implemented. Run,Forrest,run!");
                }
            }
        }
        logger.debug("collectEmbeddableFromParts -> {}",ret);
        return ret;
    } catch (Exception e)  {
        throw new RuntimeException(e);
    }
}
项目:query-utils    文件Cast.java   
public static <E,T> Singularattribute<E,Option<T>> optionalSubtype(Singularattribute<? extends E,T> attribute) throws IllegalArgumentException {
    if (attribute instanceof PseudoAttribute) {
        throw new IllegalArgumentException("No reason to wrap a PseudoAttribute. Right?");
    }
    if (attribute instanceof Bindable && Option.class.isAssignableFrom(((Bindable<?>) attribute).getBindableJavaType())) {
        throw new IllegalArgumentException("No reason to wrap an Option<?> type. Right?");
    }
    if (attribute instanceof AdditionalQueryPerformingAttribute) {
        List<Attribute<?,?>> parameters = ((AdditionalQueryPerformingAttribute) attribute).getConstructor().getParameters();
        if (parameters.size() == 1 && Option.class.isAssignableFrom(head(parameters).getJavaType())) {
            throw new IllegalArgumentException("No reason to wrap an Option<?> type. Right?");
        }
    }
    return OptionalAttribute.Constructors.optional(attribute);
}
项目:query-utils    文件QueryUtils.java   
public static boolean isrequiredByQueryAttribute(Attribute<?,?> param) {
    if (param == null) {
        return true;
    }
    if (unwrap(PseudoAttribute.class,param).isDefined()) {
        return true;
    }

    if (param instanceof AdditionalQueryPerformingAttribute && ((AdditionalQueryPerformingAttribute) param).getConstructor() instanceof TransparentProjection) {
        return isrequiredByQueryAttribute(((TransparentProjection)((AdditionalQueryPerformingAttribute) param).getConstructor()).getWrapped());
    }

    if (param instanceof JoiningAttribute && param instanceof Singularattribute) {
        return forall(QueryUtils_.isrequiredByQueryAttribute,((JoiningAttribute) param).getAttributes());
    } else if (param instanceof JoiningAttribute) {
        return true;
    }

    if (unwrap(OptionalAttribute.class,param).isDefined()) {
        return false;
    }

    if (param instanceof Bindable && Option.class.isAssignableFrom(((Bindable<?>) param).getBindableJavaType())) {
        return false;
    }

    return true;
}
项目:query-utils    文件Restrict.java   
/**
 * Modifies existing query!
 */
public <E,T1,A1 extends Attribute<? super E,?> & Bindable<T1>> CriteriaQuery<E>
innerJoin(A1 attribute,CriteriaQuery<E> query) {
    @SuppressWarnings("unchecked")
    From<?,E> from = (From<?,E>) resolveSelection(query);
    join(from,attribute,JoinType.INNER);
    return query;
}
项目:query-utils    文件Restrict.java   
/**
 * Modifies existing query!
 */
public <E,T2,T3,T4,T5,?> & Bindable<T1>,A2 extends Attribute<? super T1,?> & Bindable<T2>,A3 extends Attribute<? super T2,?> & Bindable<T3>,A4 extends Attribute<? super T3,?> & Bindable<T4>,A5 extends Attribute<? super T4,?> & Bindable<T5>> CriteriaQuery<E> 
innerJoin(A1 attribute1,A2 attribute2,A3 attribute3,A4 attribute4,A5 attribute5,E>) resolveSelection(query);
    join(join(join(join(join(from,attribute1,JoinType.INNER),attribute2,attribute3,attribute4,attribute5,T6,T7,?> & Bindable<T5>,A6 extends Attribute<? super T5,?> & Bindable<T6>,A7 extends Attribute<? super T6,?> & Bindable<T7>> CriteriaQuery<E> 
innerJoin(A1 attribute1,A6 attribute6,A7 attribute7,E>) resolveSelection(query);
    join(join(join(join(join(join(join(from,attribute6,attribute7,JoinType.INNER);
    return query;
}
项目:tap17-muggl-javaee    文件MugglPath.java   
@Override
public Bindable<X> getModel() {
    // Todo Auto-generated method stub
    return null;
}
项目:hexa.tools    文件PathImpl.java   
@Override
public Bindable<X> getModel()
{
    // Todo Auto-generated method stub
    return null;
}
项目:query-utils    文件JoiningAttribute.java   
public static <E,Y,Y2,Y3,Y4,Y5,A1 extends Attribute<E,?> & Bindable<Y>,A2 extends Attribute<? super Y,?> & Bindable<Y2>,A3 extends Attribute<? super Y2,?> & Bindable<Y3>,A4 extends Attribute<? super Y3,?> & Bindable<Y4>,A5 extends Attribute<? super Y4,?> & Bindable<Y5>>
SetAttribute<E,Y5> set(A1 a1,A2 a2,A3 a3,A4 a4,A5 a5) {
    return new JoiningSetAttribute<E,SetAttribute<E,Y5>>(newList((Attribute<?,?>)a1,(Attribute<?,?>)a2,?>)a3,?>)a4,?>)a5));
}
项目:query-utils    文件Related.java   
public static <E,R,?> & Bindable<Y>>
CollectionAttribute<E,R> collection(A1 a1,CollectionAttribute<? super Y,R> a2) {
    return JoiningAttribute.Constructors.collection(a1,a2);
}
项目:query-utils    文件Related.java   
public static <E,?> & Bindable<Y2>>
CollectionAttribute<E,CollectionAttribute<? super Y2,R> a3) {
    return JoiningAttribute.Constructors.collection(a1,a2,a3);
}
项目:query-utils    文件Related.java   
public static <E,?> & Bindable<Y3>>
CollectionAttribute<E,CollectionAttribute<? super Y3,R> a4) {
    return JoiningAttribute.Constructors.collection(a1,a3,a4);
}
项目:query-utils    文件Related.java   
public static <E,?> & Bindable<Y4>>
CollectionAttribute<E,CollectionAttribute<? super Y4,R> a5) {
    return JoiningAttribute.Constructors.collection(a1,a4,a5);
}
项目:query-utils    文件JoiningAttribute.java   
public static <E,?> & Bindable<Y3>>
ListAttribute<E,Y3> list(A1 a1,A3 a3) {
    return new JoiningListAttribute<E,ListAttribute<E,Y3>>(newList((Attribute<?,?>)a3));
}
项目:query-utils    文件Related.java   
public static <E,Y6,?> & Bindable<Y5>,A6 extends Attribute<? super Y5,?> & Bindable<Y6>>
CollectionAttribute<E,A5 a5,A6 a6,CollectionAttribute<? super Y6,R> a7) {
    return JoiningAttribute.Constructors.collection(a1,a5,a6,a7);
}
项目:query-utils    文件Related.java   
public static <E,A extends Attribute<E,?> & Bindable<Y>>
SetAttribute<E,R> set(A a1,SetAttribute<? super Y,R> a2) {
    return JoiningAttribute.Constructors.set(a1,?> & Bindable<Y2>>
SetAttribute<E,R> set(A1 a1,SetAttribute<? super Y2,R> a3) {
    return JoiningAttribute.Constructors.set(a1,?> & Bindable<Y3>>
SetAttribute<E,SetAttribute<? super Y3,R> a4) {
    return JoiningAttribute.Constructors.set(a1,?> & Bindable<Y4>>
SetAttribute<E,SetAttribute<? super Y4,R> a5) {
    return JoiningAttribute.Constructors.set(a1,a5);
}
项目:query-utils    文件Related.java   
public static <E,SetAttribute<? super Y5,R> a6) {
    return JoiningAttribute.Constructors.set(a1,a6);
}
项目:query-utils    文件Related.java   
public static <E,?> & Bindable<Y6>>
SetAttribute<E,SetAttribute<? super Y6,R> a7) {
    return JoiningAttribute.Constructors.set(a1,?> & Bindable<Y>>
ListAttribute<E,R> list(A a1,ListAttribute<? super Y,R> a2) {
    return JoiningAttribute.Constructors.list(a1,a2);
}
项目:query-utils    文件JpaCriteriaQuery.java   
public <E extends Identifiable<?>,R1,R2,R3,?> & Bindable<R1>,A2 extends Attribute<? super R1,?> & Bindable<R2>,A3 extends Attribute<? super R2,?> & Bindable<R3>>
CriteriaQuery<R3> related(A1 r1,A2 r2,A3 r3,CriteriaQuery<E> query) {
    return doRelated(query,r1,r2,r3);
}
项目:query-utils    文件Related.java   
public static <E,R> list(A1 a1,ListAttribute<? super Y3,R> a4) {
    return JoiningAttribute.Constructors.list(a1,a4);
}
项目:query-utils    文件JoiningAttribute.java   
public static <E,?> & Bindable<Y5>>
ListAttribute<E,Y5> list(A1 a1,A5 a5) {
    return new JoiningListAttribute<E,ListAttribute<? super Y5,R> a6) {
    return JoiningAttribute.Constructors.list(a1,?> & Bindable<Y6>>
ListAttribute<E,ListAttribute<? super Y6,R> a7) {
    return JoiningAttribute.Constructors.list(a1,a7);
}
项目:query-utils    文件JpaCriteriaQuery.java   
public <E extends IEntity<?> & Identifiable<?>,R4,R5,R6,R7,R8,?> & Bindable<R3>,A4 extends Attribute<? super R3,?> & Bindable<R4>,A5 extends Attribute<? super R4,?> & Bindable<R5>,A6 extends Attribute<? super R5,?> & Bindable<R6>,A7 extends Attribute<? super R6,?> & Bindable<R7>,A8 extends Attribute<? super R7,?> & Bindable<R8>>
        CriteriaQuery<R8> related(E entity,A1 r1,A4 r4,A5 r5,A6 r6,A7 r7,A8 r8) {
    return doRelated(entity,r3,r4,r5,r6,r7,r8);
}
项目:query-utils    文件Related.java   
public static <E,Y3> collection(CollectionAttribute<E,Y> a1,A3 a3) {
    return JoiningAttribute.Constructors.collection(a1,Y4> collection(CollectionAttribute<E,A4 a4) {
    return JoiningAttribute.Constructors.collection(a1,?> & Bindable<Y5>>
CollectionAttribute<E,Y5> collection(CollectionAttribute<E,A5 a5) {
    return JoiningAttribute.Constructors.collection(a1,a5);
}
项目:query-utils    文件JpaCriteriaQuery.java   
public <E extends Identifiable<?>,?> & Bindable<R5>>
CriteriaQuery<R5> related(A1 r1,r5);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。