use of org.lastaflute.di.helper.beans.exception.BeanMethodNotFoundException in project lastaflute by lastaflute.
the class LaClassificationUtil method nativeFindByCode.
// ===================================================================================
// Native Method
// =============
// -----------------------------------------------------
// cls.of(code)
// ------------
protected static OptionalThing<Classification> nativeFindByCode(Class<?> cdefType, Object code) {
assertArgumentNotNull("cdefType", cdefType);
assertArgumentNotNull("code", code);
final BeanDesc beanDesc = BeanDescFactory.getBeanDesc(cdefType);
final String methodName = "of";
final Method method;
try {
method = beanDesc.getMethod(methodName, new Class<?>[] { Object.class });
} catch (BeanMethodNotFoundException e) {
String msg = "Failed to get the method " + methodName + "() of the classification type: " + cdefType;
throw new ClassificationFindByCodeMethodNotFoundException(msg, e);
}
@SuppressWarnings("unchecked") final OptionalThing<Classification> opt = (OptionalThing<Classification>) DfReflectionUtil.invokeStatic(method, new Object[] { code });
return opt;
}
use of org.lastaflute.di.helper.beans.exception.BeanMethodNotFoundException in project lastaflute by lastaflute.
the class LaClassificationUtil method nativeCodeOf.
// -----------------------------------------------------
// Code-of
// -------
public static Object nativeCodeOf(Class<?> cdefType, Object code) {
// old method
assertArgumentNotNull("cdefType", cdefType);
assertArgumentNotNull("code", code);
final BeanDesc beanDesc = BeanDescFactory.getBeanDesc(cdefType);
final String methodName = "codeOf";
final Method method;
try {
method = beanDesc.getMethod(methodName, new Class<?>[] { Object.class });
} catch (BeanMethodNotFoundException e) {
String msg = "Failed to get the method " + methodName + "() of the classification type: " + cdefType;
throw new ClassificationCodeOfMethodNotFoundException(msg, e);
}
return DfReflectionUtil.invokeStatic(method, new Object[] { code });
}
use of org.lastaflute.di.helper.beans.exception.BeanMethodNotFoundException in project lastaflute by lastaflute.
the class LaClassificationUtil method nativeMetaOf.
// -----------------------------------------------------
// Meta of
// -------
public static Object nativeMetaOf(Class<?> defmetaType, String classificationName) {
// old method
assertArgumentNotNull("defmetaType", defmetaType);
assertArgumentNotNull("classificationName", classificationName);
final BeanDesc beanDesc = BeanDescFactory.getBeanDesc(defmetaType);
final String methodName = "meta";
final Method method;
try {
method = beanDesc.getMethod(methodName, new Class<?>[] { String.class });
} catch (BeanMethodNotFoundException e) {
String msg = "Failed to get the method " + methodName + "() of the def-meta type: " + defmetaType;
throw new ClassificationMetaOfMethodNotFoundException(msg, e);
}
return DfReflectionUtil.invokeStatic(method, new Object[] { classificationName });
}
use of org.lastaflute.di.helper.beans.exception.BeanMethodNotFoundException in project lastaflute by lastaflute.
the class LaClassificationUtil method nativeFindMeta.
// -----------------------------------------------------
// meta.find(name)
// ---------------
protected static OptionalThing<ClassificationMeta> nativeFindMeta(Class<?> defmetaType, String classificationName) {
// old method
assertArgumentNotNull("defmetaType", defmetaType);
assertArgumentNotNull("classificationName", classificationName);
final BeanDesc beanDesc = BeanDescFactory.getBeanDesc(defmetaType);
final String methodName = "find";
final Method method;
try {
method = beanDesc.getMethod(methodName, new Class<?>[] { String.class });
} catch (BeanMethodNotFoundException e) {
String msg = "Failed to get the method " + methodName + "() of the def-meta type: " + defmetaType;
throw new ClassificationMetaFindMethodNotFoundException(msg, e);
}
@SuppressWarnings("unchecked") OptionalThing<ClassificationMeta> opt = (OptionalThing<ClassificationMeta>) DfReflectionUtil.invokeStatic(method, new Object[] { classificationName });
return opt;
}
Aggregations