![]() |
![]() |
commons-beanutils-1.7.016:34:37.421 INFO jd.cli.Main - Decompiling commons-beanutils-1.7.0.jar package org.apache.commons.beanutils; import java.io.Serializable; import java.util.Comparator; import org.apache.commons.collections.comparators.ComparableComparator; public class BeanComparator implements Comparator, Serializable { private String property; private Comparator comparator; public BeanComparator() { this(null); } public BeanComparator(String property) { this(property, ComparableComparator.getInstance()); } public BeanComparator(String property, Comparator comparator) { setProperty(property); this.comparator = comparator; } public void setProperty(String property) { this.property = property; } public String getProperty() { return property; } public Comparator getComparator() { return comparator; } public int compare(Object o1, Object o2) { if (property == null) { return comparator.compare(o1, o2); } try { Object value1 = PropertyUtils.getProperty(o1, property); Object value2 = PropertyUtils.getProperty(o2, property); return comparator.compare(value1, value2); } catch (Exception e) { throw new ClassCastException(e.toString()); } } public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof BeanComparator)) { return false; } BeanComparator beanComparator = (BeanComparator)o; if (!comparator.equals(comparator)) { return false; } if (property != null) { if (!property.equals(property)) { return false; } } else { return property == null; } return true; } public int hashCode() { int result = comparator.hashCode(); return result; } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanComparator * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$1 implements Transformer { public Object transform(Object input) { return Boolean.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.1 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$2 implements Transformer { public Object transform(Object input) { return new Character(input.toString().charAt(0)); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.2 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$3 implements Transformer { public Object transform(Object input) { return Byte.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.3 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$4 implements Transformer { public Object transform(Object input) { return Short.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.4 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$5 implements Transformer { public Object transform(Object input) { return Integer.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.5 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$6 implements Transformer { public Object transform(Object input) { return Long.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.6 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$7 implements Transformer { public Object transform(Object input) { return Float.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.7 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.Transformer; class BeanMap$8 implements Transformer { public Object transform(Object input) { return Double.valueOf(input.toString()); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.8 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.util.AbstractSet; import java.util.HashMap; import java.util.Iterator; class BeanMap$9 extends AbstractSet { private final BeanMap this$0; public Iterator iterator() { return this$0.entryIterator(); } BeanMap$9(BeanMap this$0) { this.this$0 = this$0; } public int size() { return BeanMap.access$000(this$0).size(); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.9 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.util.Iterator; class BeanMap$10 implements Iterator { private final Iterator val$iter; private final BeanMap this$0; public boolean hasNext() { return val$iter.hasNext(); } public Object next() { Object key = val$iter.next(); return this$0.get(key); } BeanMap$10(BeanMap this$0, Iterator val$iter) { this.this$0 = this$0;this.val$iter = val$iter; } public void remove() { throw new UnsupportedOperationException("remove() not supported for BeanMap"); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.10 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.util.Iterator; class BeanMap$11 implements Iterator { private final Iterator val$iter; private final BeanMap this$0; public boolean hasNext() { return val$iter.hasNext(); } public Object next() { Object key = val$iter.next(); Object value = this$0.get(key); return new BeanMap.Entry(this$0, key, value); } BeanMap$11(BeanMap this$0, Iterator val$iter) { this.this$0 = this$0;this.val$iter = val$iter; } public void remove() { throw new UnsupportedOperationException("remove() not supported for BeanMap"); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.11 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import org.apache.commons.collections.keyvalue.AbstractMapEntry; public class BeanMap$Entry extends AbstractMapEntry { private BeanMap owner; protected BeanMap$Entry(BeanMap owner, Object key, Object value) { super(key, value); this.owner = owner; } public Object setValue(Object value) { Object key = getKey(); Object oldValue = owner.get(key); owner.put(key, value); Object newValue = owner.get(key); super.setValue(newValue); return oldValue; } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap.Entry * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.io.PrintStream; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.AbstractMap; import java.util.AbstractSet; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Set; import org.apache.commons.collections.Transformer; import org.apache.commons.collections.keyvalue.AbstractMapEntry; import org.apache.commons.collections.list.UnmodifiableList; import org.apache.commons.collections.set.UnmodifiableSet; public class BeanMap extends AbstractMap implements Cloneable { private transient Object bean; private transient HashMap readMethods = new HashMap(); private transient HashMap writeMethods = new HashMap(); private transient HashMap types = new HashMap(); public static final Object[] NULL_ARGUMENTS = new Object[0]; public static HashMap defaultTransformers = new HashMap(); static { defaultTransformers.put(Boolean.TYPE, new Transformer() { public Object transform(Object input) { return Boolean.valueOf(input.toString()); } }); defaultTransformers.put(Character.TYPE, new Transformer() { public Object transform(Object input) { return new Character(input.toString().charAt(0)); } }); defaultTransformers.put(Byte.TYPE, new Transformer() { public Object transform(Object input) { return Byte.valueOf(input.toString()); } }); defaultTransformers.put(Short.TYPE, new Transformer() { public Object transform(Object input) { return Short.valueOf(input.toString()); } }); defaultTransformers.put(Integer.TYPE, new Transformer() { public Object transform(Object input) { return Integer.valueOf(input.toString()); } }); defaultTransformers.put(Long.TYPE, new Transformer() { public Object transform(Object input) { return Long.valueOf(input.toString()); } }); defaultTransformers.put(Float.TYPE, new Transformer() { public Object transform(Object input) { return Float.valueOf(input.toString()); } }); defaultTransformers.put(Double.TYPE, new Transformer() { public Object transform(Object input) { return Double.valueOf(input.toString()); } }); } public BeanMap(Object bean) { this.bean = bean; initialise(); } public String toString() { return "BeanMap<" + String.valueOf(bean) + ">"; } public Object clone() throws CloneNotSupportedException { BeanMap newMap = (BeanMap)super.clone(); if (bean == null) { return newMap; } Object newBean = null; Class beanClass = null; try { beanClass = bean.getClass(); newBean = beanClass.newInstance(); } catch (Exception e) { throw new CloneNotSupportedException("Unable to instantiate the underlying bean \"" + beanClass.getName() + "\": " + e); } try { newMap.setBean(newBean); } catch (Exception exception) { throw new CloneNotSupportedException("Unable to set bean in the cloned bean map: " + exception); } try { Iterator readableKeys = readMethods.keySet().iterator(); while (readableKeys.hasNext()) { Object key = readableKeys.next(); if (getWriteMethod(key) != null) { newMap.put(key, get(key)); } } } catch (Exception exception) { throw new CloneNotSupportedException("Unable to copy bean values to cloned bean map: " + exception); } return newMap; } public void putAllWriteable(BeanMap map) { Iterator readableKeys = readMethods.keySet().iterator(); while (readableKeys.hasNext()) { Object key = readableKeys.next(); if (getWriteMethod(key) != null) { put(key, map.get(key)); } } } public void clear() { if (bean == null) { return; } Class beanClass = null; try { beanClass = bean.getClass(); bean = beanClass.newInstance(); } catch (Exception e) { throw new UnsupportedOperationException("Could not create new instance of class: " + beanClass); } } public boolean containsKey(Object name) { Method method = getReadMethod(name); return method != null; } public boolean containsValue(Object value) { return super.containsValue(value); } public Object get(Object name) { if (bean != null) { Method method = getReadMethod(name); if (method != null) { try { return method.invoke(bean, NULL_ARGUMENTS); } catch (IllegalAccessException e) { logWarn(e); } catch (IllegalArgumentException e) { logWarn(e); } catch (InvocationTargetException e) { logWarn(e); } catch (NullPointerException e) { logWarn(e); } } } return null; } public Object put(Object name, Object value) throws IllegalArgumentException, ClassCastException { if (bean != null) { Object oldValue = get(name); Method method = getWriteMethod(name); if (method == null) { throw new IllegalArgumentException("The bean of type: " + bean.getClass().getName() + " has no property called: " + name); } try { Object[] arguments = createWriteMethodArguments(method, value); method.invoke(bean, arguments); Object newValue = get(name); firePropertyChange(name, oldValue, newValue); } catch (InvocationTargetException e) { logInfo(e); throw new IllegalArgumentException(e.getMessage()); } catch (IllegalAccessException e) { logInfo(e); throw new IllegalArgumentException(e.getMessage()); } return oldValue; } return null; } public int size() { return readMethods.size(); } public Set keySet() { return UnmodifiableSet.decorate(readMethods.keySet()); } public Set entrySet() { UnmodifiableSet.decorate(new AbstractSet() { public Iterator iterator() { return entryIterator(); } public int size() { return readMethods.size(); } }); } public Collection values() { ArrayList answer = new ArrayList(readMethods.size()); for (Iterator iter = valueIterator(); iter.hasNext();) { answer.add(iter.next()); } return UnmodifiableList.decorate(answer); } public Class getType(String name) { return (Class)types.get(name); } public Iterator keyIterator() { return readMethods.keySet().iterator(); } public Iterator valueIterator() { Iterator iter = keyIterator(); new Iterator() { private final Iterator val$iter; public boolean hasNext() { return val$iter.hasNext(); } public Object next() { Object key = val$iter.next(); return get(key); } public void remove() { throw new UnsupportedOperationException("remove() not supported for BeanMap"); } }; } public Iterator entryIterator() { Iterator iter = keyIterator(); new Iterator() { private final Iterator val$iter; public boolean hasNext() { return val$iter.hasNext(); } public Object next() { Object key = val$iter.next(); Object value = get(key); return new BeanMap.Entry(BeanMap.this, key, value); } public void remove() { throw new UnsupportedOperationException("remove() not supported for BeanMap"); } }; } public Object getBean() { return bean; } public void setBean(Object newBean) { bean = newBean; reinitialise(); } public Method getReadMethod(String name) { return (Method)readMethods.get(name); } public Method getWriteMethod(String name) { return (Method)writeMethods.get(name); } protected Method getReadMethod(Object name) { return (Method)readMethods.get(name); } protected Method getWriteMethod(Object name) { return (Method)writeMethods.get(name); } protected void reinitialise() { readMethods.clear(); writeMethods.clear(); types.clear(); initialise(); } private void initialise() { if (getBean() == null) { return; } Class beanClass = getBean().getClass(); try { BeanInfo beanInfo = Introspector.getBeanInfo(beanClass); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); if (propertyDescriptors != null) { for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor propertyDescriptor = propertyDescriptors[i]; if (propertyDescriptor != null) { String name = propertyDescriptor.getName(); Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); Class aType = propertyDescriptor.getPropertyType(); if (readMethod != null) { readMethods.put(name, readMethod); } if (writeMethods != null) { writeMethods.put(name, writeMethod); } types.put(name, aType); } } } } catch (IntrospectionException e) { logWarn(e); } } protected static class Entry extends AbstractMapEntry { private BeanMap owner; protected Entry(BeanMap owner, Object key, Object value) { super(value); this.owner = owner; } public Object setValue(Object value) { Object key = getKey(); Object oldValue = owner.get(key); owner.put(key, value); Object newValue = owner.get(key); super.setValue(newValue); return oldValue; } } protected Object[] createWriteMethodArguments(Method method, Object value) throws IllegalAccessException, ClassCastException { try { if (value != null) { Class[] types = method.getParameterTypes(); if ((types != null) && (types.length > 0)) { Class paramType = types[0]; if (!paramType.isAssignableFrom(value.getClass())) { value = convertType(paramType, value); } } } return new Object[] { value }; } catch (InvocationTargetException e) { logInfo(e); throw new IllegalArgumentException(e.getMessage()); } catch (InstantiationException e) { logInfo(e); throw new IllegalArgumentException(e.getMessage()); } } protected Object convertType(Class newType, Object value) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Class[] types = { value.getClass() }; try { Constructor constructor = newType.getConstructor(types); Object[] arguments = { value }; return constructor.newInstance(arguments); } catch (NoSuchMethodException e) { Transformer transformer = getTypeTransformer(newType); if (transformer != null) { return transformer.transform(value); } } return value; } protected Transformer getTypeTransformer(Class aType) { return (Transformer)defaultTransformers.get(aType); } protected void logInfo(Exception ex) { System.out.println("INFO: Exception: " + ex); } protected void logWarn(Exception ex) { System.out.println("WARN: Exception: " + ex); ex.printStackTrace(); } public BeanMap() {} protected void firePropertyChange(Object key, Object oldValue, Object newValue) {} } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanMap * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.lang.reflect.InvocationTargetException; import org.apache.commons.collections.Predicate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class BeanPredicate implements Predicate { private final Log log = LogFactory.getLog(getClass()); private String propertyName; private Predicate predicate; public BeanPredicate(String propertyName, Predicate predicate) { this.propertyName = propertyName; this.predicate = predicate; } public boolean evaluate(Object object) { boolean evaluation = false; try { Object propValue = PropertyUtils.getProperty(object, propertyName); evaluation = predicate.evaluate(propValue); } catch (IllegalArgumentException e) { String errorMsg = "Problem during evaluation."; log.error("ERROR: Problem during evaluation.", e); throw e; } catch (IllegalAccessException e) { String errorMsg = "Unable to access the property provided."; log.error("Unable to access the property provided.", e); throw new IllegalArgumentException("Unable to access the property provided."); } catch (InvocationTargetException e) { String errorMsg = "Exception occurred in property's getter"; log.error("Exception occurred in property's getter", e); throw new IllegalArgumentException("Exception occurred in property's getter"); } catch (NoSuchMethodException e) { String errorMsg = "Property not found."; log.error("Property not found.", e); throw new IllegalArgumentException("Property not found."); } return evaluation; } public String getPropertyName() { return propertyName; } public void setPropertyName(String propertyName) { this.propertyName = propertyName; } public Predicate getPredicate() { return predicate; } public void setPredicate(Predicate predicate) { this.predicate = predicate; } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanPredicate * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.lang.reflect.InvocationTargetException; import org.apache.commons.collections.Closure; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class BeanPropertyValueChangeClosure implements Closure { private final Log log = LogFactory.getLog(getClass()); private String propertyName; private Object propertyValue; private boolean ignoreNull; public BeanPropertyValueChangeClosure(String propertyName, Object propertyValue) { this(propertyName, propertyValue, false); } public BeanPropertyValueChangeClosure(String propertyName, Object propertyValue, boolean ignoreNull) { if ((propertyName != null) && (propertyName.length() > 0)) { this.propertyName = propertyName; this.propertyValue = propertyValue; this.ignoreNull = ignoreNull; } else { throw new IllegalArgumentException("propertyName cannot be null or empty"); } } public void execute(Object object) { try { PropertyUtils.setProperty(object, propertyName, propertyValue); } catch (IllegalArgumentException e) { String errorMsg = "Unable to execute Closure. Null value encountered in property path..."; if (ignoreNull) { log.warn("WARNING: Unable to execute Closure. Null value encountered in property path...", e); } else { log.error("ERROR: Unable to execute Closure. Null value encountered in property path...", e); throw e; } } catch (IllegalAccessException e) { String errorMsg = "Unable to access the property provided."; log.error("Unable to access the property provided.", e); throw new IllegalArgumentException("Unable to access the property provided."); } catch (InvocationTargetException e) { String errorMsg = "Exception occurred in property's getter"; log.error("Exception occurred in property's getter", e); throw new IllegalArgumentException("Exception occurred in property's getter"); } catch (NoSuchMethodException e) { String errorMsg = "Property not found"; log.error("Property not found", e); throw new IllegalArgumentException("Property not found"); } } public String getPropertyName() { return propertyName; } public Object getPropertyValue() { return propertyValue; } public boolean isIgnoreNull() { return ignoreNull; } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanPropertyValueChangeClosure * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.lang.reflect.InvocationTargetException; import org.apache.commons.collections.Predicate; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class BeanPropertyValueEqualsPredicate implements Predicate { private final Log log = LogFactory.getLog(getClass()); private String propertyName; private Object propertyValue; private boolean ignoreNull; public BeanPropertyValueEqualsPredicate(String propertyName, Object propertyValue) { this(propertyName, propertyValue, false); } public BeanPropertyValueEqualsPredicate(String propertyName, Object propertyValue, boolean ignoreNull) { if ((propertyName != null) && (propertyName.length() > 0)) { this.propertyName = propertyName; this.propertyValue = propertyValue; this.ignoreNull = ignoreNull; } else { throw new IllegalArgumentException("propertyName cannot be null or empty"); } } public boolean evaluate(Object object) { boolean evaluation = false; try { evaluation = evaluateValue(propertyValue, PropertyUtils.getProperty(object, propertyName)); } catch (IllegalArgumentException e) { String errorMsg = "Problem during evaluation. Null value encountered in property path..."; if (ignoreNull) { log.warn("WARNING: Problem during evaluation. Null value encountered in property path...", e); } else { log.error("ERROR: Problem during evaluation. Null value encountered in property path...", e); throw e; } } catch (IllegalAccessException e) { String errorMsg = "Unable to access the property provided."; log.error("Unable to access the property provided.", e); throw new IllegalArgumentException("Unable to access the property provided."); } catch (InvocationTargetException e) { String errorMsg = "Exception occurred in property's getter"; log.error("Exception occurred in property's getter", e); throw new IllegalArgumentException("Exception occurred in property's getter"); } catch (NoSuchMethodException e) { String errorMsg = "Property not found."; log.error("Property not found.", e); throw new IllegalArgumentException("Property not found."); } return evaluation; } private boolean evaluateValue(Object expected, Object actual) { return (expected == actual) || ((expected != null) && (expected.equals(actual))); } public String getPropertyName() { return propertyName; } public Object getPropertyValue() { return propertyValue; } public boolean isIgnoreNull() { return ignoreNull; } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanPropertyValueEqualsPredicate * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.lang.reflect.InvocationTargetException; import org.apache.commons.collections.Transformer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class BeanToPropertyValueTransformer implements Transformer { private final Log log = LogFactory.getLog(getClass()); private String propertyName; private boolean ignoreNull; public BeanToPropertyValueTransformer(String propertyName) { this(propertyName, false); } public BeanToPropertyValueTransformer(String propertyName, boolean ignoreNull) { if ((propertyName != null) && (propertyName.length() > 0)) { this.propertyName = propertyName; this.ignoreNull = ignoreNull; } else { throw new IllegalArgumentException("propertyName cannot be null or empty"); } } public Object transform(Object object) { Object propertyValue = null; try { propertyValue = PropertyUtils.getProperty(object, propertyName); } catch (IllegalArgumentException e) { String errorMsg = "Problem during transformation. Null value encountered in property path..."; if (ignoreNull) { log.warn("WARNING: Problem during transformation. Null value encountered in property path...", e); } else { log.error("ERROR: Problem during transformation. Null value encountered in property path...", e); throw e; } } catch (IllegalAccessException e) { String errorMsg = "Unable to access the property provided."; log.error("Unable to access the property provided.", e); throw new IllegalArgumentException("Unable to access the property provided."); } catch (InvocationTargetException e) { String errorMsg = "Exception occurred in property's getter"; log.error("Exception occurred in property's getter", e); throw new IllegalArgumentException("Exception occurred in property's getter"); } catch (NoSuchMethodException e) { String errorMsg = "No property found for name [" + propertyName + "]"; log.error(errorMsg, e); throw new IllegalArgumentException(errorMsg); } return propertyValue; } public String getPropertyName() { return propertyName; } public boolean isIgnoreNull() { return ignoreNull; } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanToPropertyValueTransformer * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; public class BeanAccessLanguageException extends IllegalArgumentException { public BeanAccessLanguageException() {} public BeanAccessLanguageException(String message) { super(message); } } /* Location: * Qualified Name: org.apache.commons.beanutils.BeanAccessLanguageException * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils.locale; /** * @deprecated */ public class LocaleBeanUtils$Descriptor { private int index = -1; private String name; private String propName; private String key; private Object target; public LocaleBeanUtils$Descriptor(Object target, String name, String propName, String key, int index) { setTarget(target); setName(name); setPropName(propName); setKey(key); setIndex(index); } public Object getTarget() { return target; } public void setTarget(Object target) { this.target = target; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPropName() { return propName; } public void setPropName(String propName) { this.propName = propName; } } /* Location: * Qualified Name: org.apache.commons.beanutils.locale.LocaleBeanUtils.Descriptor * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.beanutils; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.io.StreamCorruptedException; import java.util.List; import java.util.Map; public class DynaProperty implements Serializable { private static final int BOOLEAN_TYPE = 1; private static final int BYTE_TYPE = 2; private static final int CHAR_TYPE = 3; private static final int DOUBLE_TYPE = 4; private static final int FLOAT_TYPE = 5; private static final int INT_TYPE = 6; private static final int LONG_TYPE = 7; private static final int SHORT_TYPE = 8; public DynaProperty(String name) { this(name, Object.class); } public DynaProperty(String name, Class type) { this.name = name; this.type = type; } public DynaProperty(String name, Class type, Class contentType) { this.name = name; this.type = type; this.contentType = contentType; } protected String name = null; public String getName() { return name; } protected transient Class type = null; protected transient Class contentType; public Class getType() { return type; } public Class getContentType() { return contentType; } public boolean isIndexed() { if (type == null) { return false; } if (type.isArray()) { return true; } if (List.class.isAssignableFrom(type)) { return true; } return false; } public boolean isMapped() { if (type == null) { return false; } return Map.class.isAssignableFrom(type); } public String toString() { StringBuffer sb = new StringBuffer("DynaProperty[name="); sb.append(name); sb.append(",type="); sb.append(type); if ((isMapped()) || (isIndexed())) { sb.append(" <").append(contentType).append(">"); } sb.append("]"); return sb.toString(); } private void writeObject(ObjectOutputStream out) throws IOException { writeAnyClass(type, out); if ((isMapped()) || (isIndexed())) { writeAnyClass(contentType, out); } out.defaultWriteObject(); } private void writeAnyClass(Class clazz, ObjectOutputStream out) throws IOException { int primitiveType = 0; if (Boolean.TYPE.equals(clazz)) { primitiveType = 1; } else if (Byte.TYPE.equals(clazz)) { primitiveType = 2; } else if (Character.TYPE.equals(clazz)) { primitiveType = 3; } else if (Double.TYPE.equals(clazz)) { primitiveType = 4; } else if (Float.TYPE.equals(clazz)) { primitiveType = 5; } else if (Integer.TYPE.equals(clazz)) { primitiveType = 6; } else if (Long.TYPE.equals(clazz)) { primitiveType = 7; } else if (Short.TYPE.equals(clazz)) { primitiveType = 8; } if (primitiveType == 0) { out.writeBoolean(false); out.writeObject(clazz); } else { out.writeBoolean(true); out.writeInt(primitiveType); } } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { type = readAnyClass(in); if ((isMapped()) || (isIndexed())) { contentType = readAnyClass(in); } in.defaultReadObject(); } private Class readAnyClass(ObjectInputStream in) throws IOException, ClassNotFoundException { if (in.readBoolean()) { switch (in.readInt()) { case 1: return Boolean.TYPE; case 2: return Byte.TYPE; case 3: return Character.TYPE; case 4: return Double.TYPE; case 5: return Float.TYPE; case 6: return Integer.TYPE; case 7: return Long.TYPE; case 8: return Short.TYPE; } throw new StreamCorruptedException("Invalid primitive type. Check version of beanutils used to serialize is compatible."); } return (Class)in.readObject(); } } /* Location: * Qualified Name: org.apache.commons.beanutils.DynaProperty * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.apache.commons.collections; import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; import java.util.Set; public class FastHashMap extends HashMap { protected HashMap map = null; protected boolean fast = false; public FastHashMap() { map = new HashMap(); } public FastHashMap(int capacity) { map = new HashMap(capacity); } public FastHashMap(int capacity, float factor) { map = new HashMap(capacity, factor); } public FastHashMap(Map map) { this.map = new HashMap(map); } public boolean getFast() { return fast; } public void setFast(boolean fast) { this.fast = fast; } /* Error */ public Object get(Object key) { // Byte code: // 0: aload_0 // 1: getfield 3 org/apache/commons/collections/FastHashMap:fast Z // 4: ifeq +12 -> 16 // 7: aload_0 // 8: getfield 2 org/apache/commons/collections/FastHashMap:map Ljava/util/HashMap; // 11: aload_1 // 12: invokevirtual 8 java/util/HashMap:get (Ljava/lang/Object;)Ljava/lang/Object; // 15: areturn // 16: aload_0 // 17: getfield 2 org/apache/commons/collections/FastHashMap:map Ljava/util/HashMap; // 20: dup // 21: astore_2 // 22: monitorenter // 23: aload_0 // 24: getfield 2 org/apache/commons/collections/FastHashMap:map Ljava/util/HashMap; // 27: aload_1 // 28: invokevirtual 8 java/util/HashMap:get (Ljava/lang/Object;)Ljava/lang/Object; // 31: aload_2 // 32: monitorexit // 33: areturn // 34: astore_3 // 35: aload_2 // 36: monitorexit // 37: aload_3 // 38: athrow // Line number table: // Java source line #157 -> byte code offset #0 // Java source line #158 -> byte code offset #7 // Java source line #160 -> byte code offset #16 // Java source line #161 -> byte code offset #23 // Java source line #162 -> byte code offset #34 // Local variable table: // start length slot name signature // 0 39 0 this FastHashMap // 0 39 1 key Object // 21 15 2 Ljava/lang/Object; Object // 34 4 3 localObject1 Object // Exception table: // from to target type // 23 33 34 finally // 34 37 34 finally } /* Error */ public int size() { // Byte code: // 0: aload_0 // 1: getfield 3 org/apache/commons/collections/FastHashMap:fast Z // 4: ifeq +11 -> 15 // 7: aload_0 // 8: getfield 2 org/apache/commons/collections/FastHashMap:map Ljava/util/HashMap; // 11: invokevirtual 9 java/util/HashMap:size ()I // 14: ireturn // 15: aload_0 // 16: getfield 2 org/apache/commons/collections/FastHashMap:map Ljava/util/HashMap; // 19: dup // 20: astore_1 // 21: monitorenter // 22: aload_0 // 23: getfield 2 org/apache/commons/collections/FastHashMap:map Ljava/util/HashMap; // 26: invokevirtual 9 java/util/HashMap:size ()I // 29: aload_1 // 30: monitorexit // 31: ireturn // 32: astore_2 // 33: aload_1 // 34: monitorexit // 35: aload_2 // 36: athrow // Line number table: // Java source line #172 -> byte code offset #0 // Java source line #173 -> byte code offset #7 // Java source line #175 -> byte code offset #15 // Java source line #176 -> byte code offset #22 // Java source line #177 -> byte code offset #32 // Local variable table: // start length slot Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|