Exemplo n.º 1
0
 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;
 }
Exemplo n.º 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);
   }
 }