本文整理匯總了Java中javax.persistence.AttributeOverrides.value方法的典型用法代碼示例。如果您正苦於以下問題:Java AttributeOverrides.value方法的具體用法?Java AttributeOverrides.value怎麽用?Java AttributeOverrides.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.persistence.AttributeOverrides
的用法示例。
在下文中一共展示了AttributeOverrides.value方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mergeAttributeOverrides
import javax.persistence.AttributeOverrides; //導入方法依賴的package包/類
/**
* @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 AttributeOverrides mergeAttributeOverrides(XMLContext.Default defaults, List<AttributeOverride> attributes, boolean mergeWithAnnotations) {
if ( mergeWithAnnotations && defaults.canUseJavaAnnotations() ) {
AttributeOverride annotation = getPhysicalAnnotation( AttributeOverride.class );
addAttributeOverrideIfNeeded( annotation, attributes );
AttributeOverrides annotations = getPhysicalAnnotation( AttributeOverrides.class );
if ( annotations != null ) {
for ( AttributeOverride current : annotations.value() ) {
addAttributeOverrideIfNeeded( current, attributes );
}
}
}
if ( attributes.size() > 0 ) {
AnnotationDescriptor ad = new AnnotationDescriptor( AttributeOverrides.class );
ad.setValue( "value", attributes.toArray( new AttributeOverride[attributes.size()] ) );
return AnnotationFactory.create( ad );
}
else {
return null;
}
}
示例2: getAttributeOverrides
import javax.persistence.AttributeOverrides; //導入方法依賴的package包/類
public static final AttributeOverride[] getAttributeOverrides(final AnnotatedElement ae) {
AttributeOverride[] overrides = null;
final AttributeOverrides aos = ae.getAnnotation(AttributeOverrides.class);
if (aos != null) {
overrides = aos.value();
}
if (overrides == null || overrides.length == 0) {
final AttributeOverride override = ae.getAnnotation(AttributeOverride.class);
if (override != null) {
overrides = new AttributeOverride[1];
overrides[0] = override;
} else {
overrides = new AttributeOverride[0];
}
}
return overrides;
}
示例3: getAttributeOverride
import javax.persistence.AttributeOverrides; //導入方法依賴的package包/類
private static Column getAttributeOverride(Class<?> type, String name) {
AttributeOverride ao = type.getAnnotation(AttributeOverride.class);
if (ao != null) {
if (ao.name().equals(name)) {
return ao.column();
}
}
AttributeOverrides aos = type.getAnnotation(AttributeOverrides.class);
if (aos != null) {
for (AttributeOverride a : aos.value()) {
if (a.name().equals(name)) {
return a.column();
}
}
}
return null;
}
示例4: getAttributeOverrides
import javax.persistence.AttributeOverrides; //導入方法依賴的package包/類
public static final AttributeOverride[] getAttributeOverrides(AnnotatedElement ae) {
AttributeOverride[] overrides = null;
AttributeOverrides aos = ae.getAnnotation(AttributeOverrides.class);
if (aos != null) {
overrides = aos.value();
}
if (overrides == null || overrides.length == 0) {
AttributeOverride override = ae.getAnnotation(AttributeOverride.class);
if (override != null) {
overrides = new AttributeOverride[1];
overrides[0] = override;
} else {
overrides = new AttributeOverride[0];
}
}
return overrides;
}
示例5: buildColumnOverride
import javax.persistence.AttributeOverrides; //導入方法依賴的package包/類
private static Map<String, Column[]> buildColumnOverride(XAnnotatedElement element, String path) {
Map<String, Column[]> columnOverride = new HashMap<String, Column[]>();
if ( element == null ) return columnOverride;
AttributeOverride singleOverride = element.getAnnotation( AttributeOverride.class );
AttributeOverrides multipleOverrides = element.getAnnotation( AttributeOverrides.class );
AttributeOverride[] overrides;
if ( singleOverride != null ) {
overrides = new AttributeOverride[] { singleOverride };
}
else if ( multipleOverrides != null ) {
overrides = multipleOverrides.value();
}
else {
overrides = null;
}
//fill overridden columns
if ( overrides != null ) {
for (AttributeOverride depAttr : overrides) {
columnOverride.put(
StringHelper.qualify( path, depAttr.name() ),
new Column[] { depAttr.column() }
);
}
}
return columnOverride;
}