예제 #1
0
파일: Helper.java 프로젝트: nladd/dayTrader
 public static Iterable<CascadeStyle> interpretCascadeStyles(
     String cascades, LocalBindingContext bindingContext) {
   final Set<CascadeStyle> cascadeStyles = new HashSet<CascadeStyle>();
   if (StringHelper.isEmpty(cascades)) {
     cascades = bindingContext.getMappingDefaults().getCascadeStyle();
   }
   for (String cascade : StringHelper.split(",", cascades)) {
     cascadeStyles.add(CascadeStyle.getCascadeStyle(cascade));
   }
   return cascadeStyles;
 }
예제 #2
0
 public CascadeStyle getCascadeStyle() throws MappingException {
   Type type = value.getType();
   if (type.isComponentType() && !type.isAnyType()) {
     CompositeType actype = (CompositeType) type;
     int length = actype.getSubtypes().length;
     for (int i = 0; i < length; i++) {
       if (actype.getCascadeStyle(i) != CascadeStyle.NONE) return CascadeStyle.ALL;
     }
     return CascadeStyle.NONE;
   } else if (cascade == null || cascade.equals("none")) {
     return CascadeStyle.NONE;
   } else {
     StringTokenizer tokens = new StringTokenizer(cascade, ", ");
     CascadeStyle[] styles = new CascadeStyle[tokens.countTokens()];
     int i = 0;
     while (tokens.hasMoreTokens()) {
       styles[i++] = CascadeStyle.getCascadeStyle(tokens.nextToken());
     }
     return new CascadeStyle.MultipleCascadeStyle(styles);
   }
 }