本文整理汇总了Java中javax.persistence.AccessType.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java AccessType.valueOf方法的具体用法?Java AccessType.valueOf怎么用?Java AccessType.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.AccessType
的用法示例。
在下文中一共展示了AccessType.valueOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAccessType
import javax.persistence.AccessType; //导入方法依赖的package包/类
private void getAccessType(List<Annotation> annotationList, Element element) {
if ( element == null ) {
return;
}
String access = element.attributeValue( "access" );
if ( access != null ) {
AnnotationDescriptor ad = new AnnotationDescriptor( Access.class );
AccessType type;
try {
type = AccessType.valueOf( access );
}
catch ( IllegalArgumentException e ) {
throw new AnnotationException( access + " is not a valid access type. Check you xml confguration." );
}
if ( ( AccessType.PROPERTY.equals( type ) && this.element instanceof Method ) ||
( AccessType.FIELD.equals( type ) && this.element instanceof Field ) ) {
return;
}
ad.setValue( "value", type );
annotationList.add( AnnotationFactory.create( ad ) );
}
}
示例2: getAccessFromIndex
import javax.persistence.AccessType; //导入方法依赖的package包/类
protected AccessType getAccessFromIndex(DotName className) {
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS );
if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) {
for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) {
if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) {
ClassInfo ci = (ClassInfo) ( annotationInstance.target() );
if ( className.equals( ci.name() ) ) {
//todo does ci need to have @Entity or @MappedSuperClass ??
return AccessType.valueOf( annotationInstance.value().asEnum() );
}
}
}
}
return null;
}
示例3: setAccess
import javax.persistence.AccessType; //导入方法依赖的package包/类
private void setAccess( String access, Default defaultType) {
AccessType type;
if ( access != null ) {
try {
type = AccessType.valueOf( access );
}
catch ( IllegalArgumentException e ) {
throw new AnnotationException( "Invalid access type " + access + " (check your xml configuration)" );
}
defaultType.setAccess( type );
}
}
示例4: getDefaultAccess
import javax.persistence.AccessType; //导入方法依赖的package包/类
protected AccessType getDefaultAccess() {
if ( entity.getAccess() != null ) {
return AccessType.valueOf( entity.getAccess().value() );
}
return null;
}