本文整理了Java中java.lang.NoSuchFieldException.getMessage()
方法的一些代码示例,展示了NoSuchFieldException.getMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NoSuchFieldException.getMessage()
方法的具体详情如下:
包路径:java.lang.NoSuchFieldException
类名称:NoSuchFieldException
方法名:getMessage
暂无
代码示例来源:origin: wildfly/wildfly
public Field run() {
final Field field;
try {
field = clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
throw new NoSuchFieldError(e.getMessage());
}
field.setAccessible(true);
return field;
}
}
代码示例来源:origin: wildfly/wildfly
public Unsafe run() {
try {
final Field field = Unsafe.class.getDeclaredField("theUnsafe");
field.setAccessible(true);
return (Unsafe) field.get(null);
} catch (IllegalAccessException e) {
throw new IllegalAccessError(e.getMessage());
} catch (NoSuchFieldException e) {
throw new NoSuchFieldError(e.getMessage());
}
}
});
代码示例来源:origin: wildfly/wildfly
public Field run() {
try {
return clazz.getDeclaredField(name);
} catch (NoSuchFieldException e) {
throw new NoSuchFieldError(e.getMessage());
}
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
public Field[] getEnumConstants(Class clazz) {
try {
Object[] values = clazz.getEnumConstants();
Field[] fields = new Field[values.length];
for (int i = 0; i < values.length; i++) {
fields[i] = clazz.getField(((Enum) values[i]).name());
}
return fields;
} catch (NoSuchFieldException e) {
// impossible
throw new NoSuchFieldError(e.getMessage());
}
}
代码示例来源:origin: MorphiaOrg/morphia
private Field getField(final Class c, final String field) {
try {
return c.getDeclaredField(field);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
代码示例来源:origin: udacity/ud851-Sunshine
static String studentReadableNoSuchField(NoSuchFieldException e) {
String message = e.getMessage();
Pattern p = Pattern.compile("No field (\\w*) in class L.*/(\\w*\\$?\\w*);");
Matcher m = p.matcher(message);
if (m.find()) {
String missingFieldName = m.group(1);
String classForField = m.group(2).replaceAll("\\$", ".");
String fieldNotFoundReadableMessage = "Couldn't find "
+ missingFieldName + " in class " + classForField + "."
+ "\nPlease make sure you've declared that field and followed the TODOs.";
return fieldNotFoundReadableMessage;
} else {
return e.getMessage();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!