本文整理了Java中org.eclipse.persistence.internal.helper.Helper.getAttributeNameFromMethodName()
方法的一些代码示例,展示了Helper.getAttributeNameFromMethodName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.getAttributeNameFromMethodName()
方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:getAttributeNameFromMethodName
[英]INTERNAL: Method to convert a getXyz or isXyz method name to an xyz attribute name. NOTE: The method name passed it may not actually be a method name, so by default return the name passed in.
[中]内部:将getXyz或isXyz方法名称转换为xyz属性名称的方法。注意:传递给它的方法名实际上可能不是方法名,因此默认情况下返回传入的名称。
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Return whether a map key this container policy represents is an attribute
* @return
*/
public boolean isMapKeyAttribute(){
if (elementDescriptor != null && keyName != null){
DatabaseMapping mapping = elementDescriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
if (mapping != null){
return mapping.isDirectToFieldMapping();
}
}
initializeKey();
if (keyField != null){
if (keyField.getClass().isPrimitive()){
return true;
}
} else if (keyMethod != null){
if (keyMethod.getClass().isPrimitive()){
return true;
}
}
return false;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Return whether a map key this container policy represents is an attribute.
*/
@Override
public boolean isMapKeyAttribute() {
if (elementDescriptor != null && keyName != null){
DatabaseMapping mapping = elementDescriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
if (mapping != null) {
return mapping.isDirectToFieldMapping();
}
}
initializeKey();
if (keyField != null){
if (keyField.getClass().isPrimitive()){
return true;
}
} else if (keyMethod != null) {
if (keyMethod.getClass().isPrimitive()) {
return true;
}
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Return whether a map key this container policy represents is an attribute.
*/
@Override
public boolean isMapKeyAttribute() {
if (elementDescriptor != null && keyName != null){
DatabaseMapping mapping = elementDescriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
if (mapping != null) {
return mapping.isDirectToFieldMapping();
}
}
initializeKey();
if (keyField != null){
if (keyField.getClass().isPrimitive()){
return true;
}
} else if (keyMethod != null) {
if (keyMethod.getClass().isPrimitive()) {
return true;
}
}
return false;
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
public MetadataMethodVisitor(MetadataClass classMetadata, int access, String name, String desc, String signature, String[] exceptions) {
super(Opcodes.ASM5);
this.method = new MetadataMethod(MetadataAsmFactory.this, classMetadata);
this.method.setName(name);
this.method.setAttributeName(Helper.getAttributeNameFromMethodName(name));
this.method.setModifiers(access);
this.method.setGenericType(processDescription(desc, true));
List<String> argumentNames = processDescription(signature, false);
if (argumentNames != null && !argumentNames.isEmpty()) {
this.method.setReturnType(argumentNames.get(argumentNames.size() - 1));
argumentNames.remove(argumentNames.size() - 1);
this.method.setParameters(argumentNames);
}
}
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
accessor = m_mappingAccessors.get(Helper.getAttributeNameFromMethodName(fieldOrPropertyName));
代码示例来源:origin: com.haulmont.thirdparty/eclipselink
/**
* INTERNAL:
* Return the DatabaseField that represents the key in a DirectMapMapping. MapContainerPolicy gets it fields from the reference descriptor
* of the provided mappings. It uses its keyName to lookup the appropriate mapping and returns the field from
* that mapping.
*/
@Override
public DatabaseField getDirectKeyField(CollectionMapping baseMapping){
if (baseMapping == null){
return null;
}
ClassDescriptor descriptor = baseMapping.getReferenceDescriptor();
DatabaseMapping mapping = descriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
if (mapping.isAbstractDirectMapping()){
return ((AbstractDirectMapping)mapping).getField();
}
return null;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Return the DatabaseField that represents the key in a DirectMapMapping. MapContainerPolicy gets it fields from the reference descriptor
* of the provided mappings. It uses its keyName to lookup the appropriate mapping and returns the field from
* that mapping
* @return
*/
public DatabaseField getDirectKeyField(CollectionMapping baseMapping){
if (baseMapping == null){
return null;
}
ClassDescriptor descriptor = baseMapping.getReferenceDescriptor();
DatabaseMapping mapping = descriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
if (mapping.isAbstractDirectMapping()){
return ((AbstractDirectMapping)mapping).getField();
}
return null;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core
/**
* INTERNAL:
* Return the DatabaseField that represents the key in a DirectMapMapping. MapContainerPolicy gets it fields from the reference descriptor
* of the provided mappings. It uses its keyName to lookup the appropriate mapping and returns the field from
* that mapping.
*/
@Override
public DatabaseField getDirectKeyField(CollectionMapping baseMapping){
if (baseMapping == null){
return null;
}
ClassDescriptor descriptor = baseMapping.getReferenceDescriptor();
DatabaseMapping mapping = descriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
if (mapping.isAbstractDirectMapping()){
return ((AbstractDirectMapping)mapping).getField();
}
return null;
}
代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence
/**
* INTERNAL:
* Return all the fields in the key. MapContainerPolicy gets it fields from the reference descriptor
* of the provided mappings. It uses its keyName to lookup the appropriate mapping and returns the fields from
* that mapping
* @return
*/
public List<DatabaseField> getAllFieldsForMapKey(CollectionMapping baseMapping){
if (baseMapping == null){
return null;
}
ClassDescriptor descriptor = baseMapping.getReferenceDescriptor();
if (keyName != null){
DatabaseMapping mapping = descriptor.getMappingForAttributeName(Helper.getAttributeNameFromMethodName(keyName));
return mapping.getFields();
} else {
return descriptor.getPrimaryKeyFields();
}
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.jpa.modelgen.processor
/**
* INTERNAL:
* Visit an executable and create a MetadataMethod object.
*/
@Override
public MetadataMethod visitExecutable(ExecutableElement executableElement, MetadataClass metadataClass) {
MetadataMethod method = new MetadataMethod(metadataClass.getMetadataFactory(), metadataClass);
// Set the name.
method.setName(executableElement.getSimpleName().toString());
// Set the attribute name.
method.setAttributeName(Helper.getAttributeNameFromMethodName(method.getName()));
// Set the modifiers.
method.setModifiers(getModifiers(executableElement.getModifiers()));
// Visit executable element for the parameters, return type and generic type.
executableElement.asType().accept(typeVisitor, method);
// Set the annotations.
buildMetadataAnnotations(method, executableElement.getAnnotationMirrors());
// Handle multiple methods with the same name.
MetadataMethod existing = metadataClass.getMethods().get(method.getName());
if (existing == null) {
metadataClass.addMethod(method);
} else {
while (existing.getNext() != null) {
existing = existing.getNext();
}
existing.setNext(method);
}
return method;
}
代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.jpa.modelgen
method.setAttributeName(Helper.getAttributeNameFromMethodName(method.getName()));
内容来源于网络,如有侵权,请联系作者删除!