本文整理匯總了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;
}