コード例 #1
0
 private XmlReadHandler createReadHandler(String propertyName) throws ParseException {
   try {
     final ExpressionMetaData expressionMetaData =
         ExpressionRegistry.getInstance().getExpressionMetaData(expressionClass);
     final ExpressionPropertyMetaData propertyDescription =
         expressionMetaData.getPropertyDescription(propertyName);
     if (propertyDescription != null) {
       final Class<? extends UserDefinedExpressionPropertyReadHandler> propertyReadHandler =
           propertyDescription.getPropertyReadHandler();
       if (propertyReadHandler != null) {
         final UserDefinedExpressionPropertyReadHandler xmlReadHandler =
             propertyReadHandler.newInstance();
         xmlReadHandler.init(
             beanUtility, originalExpressionClass, expressionClass, expression.getName());
         return xmlReadHandler;
       }
     }
     return new ExpressionPropertyReadHandler(
         beanUtility, originalExpressionClass, expressionClass, expression.getName());
   } catch (MetaDataLookupException e) {
     return new ExpressionPropertyReadHandler(
         beanUtility, originalExpressionClass, expressionClass, expression.getName());
   } catch (Exception e) {
     throw new ParseException(
         "Unable to read metadata for property '" + propertyName + "'.", getLocator());
   }
 }
コード例 #2
0
 private static ExpressionPropertyWriteHandler createWriteHandler(Expression e, String key) {
   try {
     final ExpressionMetaData expressionMetaData =
         ExpressionRegistry.getInstance().getExpressionMetaData(e.getClass().getName());
     final ExpressionPropertyMetaData propertyDescription =
         expressionMetaData.getPropertyDescription(key);
     final Class<? extends ExpressionPropertyWriteHandler> writeHandlerRef =
         propertyDescription.getPropertyWriteHandler();
     if (writeHandlerRef != null) {
       return writeHandlerRef.newInstance();
     }
   } catch (Exception ex) {
     logger.info("No valid property metadata defined for " + e.getClass() + " on property " + key);
   }
   return new DefaultExpressionPropertyWriteHandler();
 }