org.eclipse.persistence.internal.helper.Helper.getField()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.eclipse.persistence.internal.helper.Helper.getField()方法的一些代码示例,展示了Helper.getField()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Helper.getField()方法的具体详情如下:
包路径:org.eclipse.persistence.internal.helper.Helper
类名称:Helper
方法名:getField

Helper.getField介绍

[英]INTERNAL: Returns a Field for the specified Class and field name. Uses Class.getDeclaredField(String) to find the field. If the field is not found on the specified class the superclass is checked, and so on, recursively. Set accessible to true, so we can access private/package/protected fields.
[中]内部:返回指定类和字段名的字段。使用类。getDeclaredField(字符串)以查找字段。如果在指定的类上找不到该字段,则递归地检查超类,依此类推。将accessible设置为true,这样我们就可以访问private/package/protected字段。

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * INTERNAL:
 * Set the keyMethod or keyField based on the keyName.
 */
protected void initializeKey() {
  // Should only run through this once ...
  if (keyName != null && keyMethod == null && keyField == null) {
    try {
      keyMethod = Helper.getDeclaredMethod(elementClass, keyName, (Class[]) null);
    } catch (NoSuchMethodException ex) {
      try {
        keyField = Helper.getField(elementClass, keyName);
      } catch (NoSuchFieldException e) {
        throw ValidationException.mapKeyNotDeclaredInItemClass(keyName, elementClass);
      }
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * INTERNAL:
 * Set the keyMethod or keyField based on the keyName
 */
protected void initializeKey(){
  // Should only run through this once ...
  if (keyName != null && keyMethod == null && keyField == null) {
    try {
      keyMethod = Helper.getDeclaredMethod(elementClass, keyName, (Class[]) null);
    } catch (NoSuchMethodException ex) {
      try {
        keyField = Helper.getField(elementClass, keyName);
      } catch (NoSuchFieldException e) {
        throw ValidationException.mapKeyNotDeclaredInItemClass(keyName, elementClass);    
      }
    }
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * INTERNAL:
 * Set the keyMethod or keyField based on the keyName.
 */
protected void initializeKey() {
  // Should only run through this once ...
  if (keyName != null && keyMethod == null && keyField == null) {
    try {
      keyMethod = Helper.getDeclaredMethod(elementClass, keyName, (Class[]) null);
    } catch (NoSuchMethodException ex) {
      try {
        keyField = Helper.getField(elementClass, keyName);
      } catch (NoSuchFieldException e) {
        throw ValidationException.mapKeyNotDeclaredInItemClass(keyName, elementClass);    
      }
    }
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * instanceVariableName is converted to Field type.
 */
public void initializeAttributes(Class theJavaClass) throws DescriptorException {
  if (getAttributeName() == null) {
    throw DescriptorException.attributeNameNotSpecified();
  }
  try {
    setAttributeField(Helper.getField(theJavaClass, getAttributeName()));
  } catch (NoSuchFieldException exception) {
    throw DescriptorException.noSuchFieldWhileInitializingAttributesInInstanceVariableAccessor(getAttributeName(), theJavaClass.getName(), exception);
  } catch (SecurityException exception) {
    throw DescriptorException.securityWhileInitializingAttributesInInstanceVariableAccessor(getAttributeName(), theJavaClass.getName(), exception);
  }
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * instanceVariableName is converted to Field type.
 */
public void initializeAttributes(Class theJavaClass) throws DescriptorException {
  if (getAttributeName() == null) {
    throw DescriptorException.attributeNameNotSpecified();
  }
  try {
    setAttributeField(Helper.getField(theJavaClass, getAttributeName()));
  } catch (NoSuchFieldException exception) {
    throw DescriptorException.noSuchFieldWhileInitializingAttributesInInstanceVariableAccessor(getAttributeName(), theJavaClass.getName(), exception);
  } catch (SecurityException exception) {
    throw DescriptorException.securityWhileInitializingAttributesInInstanceVariableAccessor(getAttributeName(), theJavaClass.getName(), exception);
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * instanceVariableName is converted to Field type.
 */
@Override
public void initializeAttributes(Class theJavaClass) throws DescriptorException {
  if (getAttributeName() == null) {
    throw DescriptorException.attributeNameNotSpecified();
  }
  try {
    setAttributeField(Helper.getField(theJavaClass, getAttributeName()));
  } catch (NoSuchFieldException exception) {
    throw DescriptorException.noSuchFieldWhileInitializingAttributesInInstanceVariableAccessor(getAttributeName(), theJavaClass.getName(), exception);
  } catch (SecurityException exception) {
    throw DescriptorException.securityWhileInitializingAttributesInInstanceVariableAccessor(getAttributeName(), theJavaClass.getName(), exception);
  }
}

相关文章

Helper类方法