Java 类javax.persistence.PrimaryKeyJoinColumns 实例源码

项目:lams    文件:JPAOverriddenAnnotationReader.java   
/**
 * @param mergeWithAnnotations Whether to use Java annotations for this
 * element, if present and not disabled by the XMLContext defaults.
 * In some contexts (such as an association mapping) merging with
 * annotations is never allowed.
 */
private PrimaryKeyJoinColumns getPrimaryKeyJoinColumns(Element element, XMLContext.Default defaults, boolean mergeWithAnnotations) {
    PrimaryKeyJoinColumn[] columns = buildPrimaryKeyJoinColumns( element );
    if ( mergeWithAnnotations ) {
        if ( columns.length == 0 && defaults.canUseJavaAnnotations() ) {
            PrimaryKeyJoinColumn annotation = getPhysicalAnnotation( PrimaryKeyJoinColumn.class );
            if ( annotation != null ) {
                columns = new PrimaryKeyJoinColumn[] { annotation };
            }
            else {
                PrimaryKeyJoinColumns annotations = getPhysicalAnnotation( PrimaryKeyJoinColumns.class );
                columns = annotations != null ? annotations.value() : columns;
            }
        }
    }
    if ( columns.length > 0 ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( PrimaryKeyJoinColumns.class );
        ad.setValue( "value", columns );
        return AnnotationFactory.create( ad );
    }
    else {
        return null;
    }
}
项目:cosmic    文件:DbUtil.java   
public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(final Class<?> clazz) {
    final PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
    if (pkjc != null) {
        return new PrimaryKeyJoinColumn[]{pkjc};
    }

    final PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
    if (pkjcs != null) {
        return pkjcs.value();
    }

    return null;
}
项目:hyperjaxb3    文件:CreateXAnnotations.java   
public XAnnotation<?> createPrimaryKeyJoinColumns(
        List<PrimaryKeyJoinColumn> cPrimaryKeyJoinColumn) {
    return transform(
            PrimaryKeyJoinColumns.class,
            javax.persistence.PrimaryKeyJoinColumn.class,
            cPrimaryKeyJoinColumn,
            new Transformer<PrimaryKeyJoinColumn, XAnnotation<javax.persistence.PrimaryKeyJoinColumn>>() {
                public XAnnotation<javax.persistence.PrimaryKeyJoinColumn> transform(
                        PrimaryKeyJoinColumn input) {
                    return createPrimaryKeyJoinColumn(input);
                }

            });
}
项目:cloudstack    文件:DbUtil.java   
public static PrimaryKeyJoinColumn[] getPrimaryKeyJoinColumns(Class<?> clazz) {
    PrimaryKeyJoinColumn pkjc = clazz.getAnnotation(PrimaryKeyJoinColumn.class);
    if (pkjc != null) {
        return new PrimaryKeyJoinColumn[] {pkjc};
    }

    PrimaryKeyJoinColumns pkjcs = clazz.getAnnotation(PrimaryKeyJoinColumns.class);
    if (pkjcs != null) {
        return pkjcs.value();
    }

    return null;
}