com.ca.jcs.converter.meta
Class ORedMultiValuePropertyFlattener

java.lang.Object
  extended by com.ca.jcs.cfg.Vetoable
      extended by com.ca.jcs.converter.meta.PropertyConverter
          extended by com.ca.jcs.converter.meta.MultiValuePropertyFlattener
              extended by com.ca.jcs.converter.meta.ORedMultiValuePropertyFlattener
All Implemented Interfaces:
AttributeConverter

public class ORedMultiValuePropertyFlattener
extends MultiValuePropertyFlattener

A flattening converter that performs flattening by performing a logical OR operation on the target attribute values. This can be set on a collection of enum properties where the enum's ordinals form a binary sequence. The ORing is done by converting the symbolic names to the corresponding ordinal values and performing the OR against all attribute values. Note that in from connector direction the order of values output by un-flattening may not coincide to the order in which they were sent as the flattening itself is lossy.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.ca.jcs.converter.meta.MultiValuePropertyFlattener
MultiValuePropertyFlattener.StyleConfig
 
Field Summary
 
Fields inherited from class com.ca.jcs.converter.meta.PropertyConverter
config, prop
 
Constructor Summary
ORedMultiValuePropertyFlattener(DataModelProperty prop)
           
ORedMultiValuePropertyFlattener(MultiValuePropertyFlattener.StyleConfig cfg, DataModelProperty prop)
           
 
Method Summary
static boolean isBinaryOrdinals(DataModelEnumDef enumDef)
          Given enum definition check if its ordinals are only powers of 2
static boolean isPowerOfTwo(int n)
          Given enum definition rewrite its ordinals to form a sequence of powers of 2
 
Methods inherited from class com.ca.jcs.converter.meta.MultiValuePropertyFlattener
isModificationOpReplaceOnly
 
Methods inherited from class com.ca.jcs.converter.meta.PropertyConverter
convertFromConnector, convertToConnector, getAttrConverter, getConfig, getConverter, getTargetValueOverride, isLossy, isMultiValued, isStructural, setAttrConverter
 
Methods inherited from class com.ca.jcs.cfg.Vetoable
isVetoed, setVetoed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ORedMultiValuePropertyFlattener

public ORedMultiValuePropertyFlattener(MultiValuePropertyFlattener.StyleConfig cfg,
                                       DataModelProperty prop)

ORedMultiValuePropertyFlattener

public ORedMultiValuePropertyFlattener(DataModelProperty prop)
Method Detail

isPowerOfTwo

public static boolean isPowerOfTwo(int n)
Given enum definition rewrite its ordinals to form a sequence of powers of 2


isBinaryOrdinals

public static boolean isBinaryOrdinals(DataModelEnumDef enumDef)
Given enum definition check if its ordinals are only powers of 2



Created 2011-07-14 13:27 EST