You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/07/03 23:58:25 UTC
svn commit: r673833 [17/18] - in /myfaces/tomahawk/trunk:
core/src/main/java/org/apache/myfaces/component/
core/src/main/java/org/apache/myfaces/component/html/ext/
core/src/main/java/org/apache/myfaces/component/html/util/
core/src/main/java/org/apach...
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/MyFacesGuiBuilder.java Thu Jul 3 14:58:05 2008
@@ -41,14 +41,14 @@
*/
public class MyFacesGuiBuilder extends JsfGuiBuilder
{
- public MyFacesGuiBuilder()
- {
- super();
- }
-
- @Override
- public Converter doCreateConverter(FieldInterface field)
- {
+ public MyFacesGuiBuilder()
+ {
+ super();
+ }
+
+ @Override
+ public Converter doCreateConverter(FieldInterface field)
+ {
Class type = field.getType();
if (Float.class.isAssignableFrom(type)
@@ -56,17 +56,17 @@
|| float.class.isAssignableFrom(type)
|| double.class.isAssignableFrom(type)
|| BigDecimal.class.isAssignableFrom(type))
- {
- // use the super duper intelligent number converter
- return getContext().getApplication().createConverter(TypedNumberConverter.CONVERTER_ID);
- }
-
- return super.doCreateConverter(field);
- }
-
- @Override
- public HtmlInputText doCreateInputDateComponent(FieldInterface field)
- {
+ {
+ // use the super duper intelligent number converter
+ return getContext().getApplication().createConverter(TypedNumberConverter.CONVERTER_ID);
+ }
+
+ return super.doCreateConverter(field);
+ }
+
+ @Override
+ public HtmlInputText doCreateInputDateComponent(FieldInterface field)
+ {
if (!TemporalType.DATE.equals(field.getTemporalType()))
{
// we can select dates only - yet!
@@ -74,109 +74,109 @@
}
HtmlInputCalendar cmp = (HtmlInputCalendar) getContext()
- .getApplication().createComponent(
- HtmlInputCalendar.COMPONENT_TYPE);
- cmp.setRenderAsPopup(true);
-
- if (Boolean.FALSE.equals(field.getCanWrite()))
- {
- cmp.setReadonly(true);
- }
- if (Boolean.TRUE.equals(field.getDisabled()))
- {
- cmp.setDisabled(true);
- }
-
- return cmp;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void createInputDate(FieldInterface field)
- {
- if (isDisplayOnly())
- {
- super.createInputDate(field);
- return;
- }
+ .getApplication().createComponent(
+ HtmlInputCalendar.COMPONENT_TYPE);
+ cmp.setRenderAsPopup(true);
+
+ if (Boolean.FALSE.equals(field.getCanWrite()))
+ {
+ cmp.setReadonly(true);
+ }
+ if (Boolean.TRUE.equals(field.getDisabled()))
+ {
+ cmp.setDisabled(true);
+ }
+
+ return cmp;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void createInputDate(FieldInterface field)
+ {
+ if (isDisplayOnly())
+ {
+ super.createInputDate(field);
+ return;
+ }
- UIComponent cmp = doCreateInputDate(field);
+ UIComponent cmp = doCreateInputDate(field);
// workaround to avoid wrap of date-component and its button ==>
HtmlPanelGroup panel = doCreatePanelGroupComponent();
- panel.setId("pnl_" + cmp.getId());
- panel.getChildren().add(cmp);
- panel.setStyle("white-space:nowrap;");
+ panel.setId("pnl_" + cmp.getId());
+ panel.getChildren().add(cmp);
+ panel.setStyle("white-space:nowrap;");
// <==
- fireNewComponent(field, panel);
- }
+ fireNewComponent(field, panel);
+ }
+
+ @Override
+ public UIComponent doCreateSearchFor(FieldInterface field)
+ {
+ HtmlPanelGroup panel = doCreatePanelGroupComponent();
+
+ InputSuggestAjax cmp = new InputSuggestAjax();
+ initInputDefaults(cmp, field);
+
+ String dataSource = field.getDataSource();
+ String dataSourceDescription = field.getDataSourceDescription();
+
+ MethodBinding mbSearch = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
+ dataSource,
+ new Class[]
+ {
+ String.class
+ });
+ MethodBinding mbLabel = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
+ dataSourceDescription,
+ new Class[]
+ {
+ field.getType()
+ });
+
+ cmp.setSuggestedItemsMethod(mbSearch);
+ cmp.setItemLabelMethod(mbLabel);
+
+ if (cmp.getConverter() == null)
+ {
+ cmp.setConverter(new ObjectSerializationConverter());
+ }
+
+ panel.getChildren().add(cmp);
+ return panel;
+
+ /*
+ HtmlPanelGroup panel = doCreatePanelGroupComponent();
+
+
+ HtmlCommandLink command = doCreateCommandLink(field);
+ // avoid duplicate id
+ command.setId("cmd_" + command.getId());
+ command.setValue("...");
+ command.setStyleClass("ff_searchLink");
+ command.setImmediate(true);
+
+ command.getChildren().add(
+ createParameter(SEARCH_ENTITY_TYPE, field.getType().getName()));
+ command.getChildren().add(
+ createParameter(SEARCH_ENTITY_BINDING,
+ createValueBindingString(field)));
+
+ Converter converter = context.getApplication().createConverter(field.getType());
+ HtmlOutputText text = doCreateOutputText(field);
+ if (converter != null)
+ {
+ text.setConverter(converter);
+ }
+ panel.getChildren().add(text);
+
+ panel.getChildren().add(command);
+
+ panel.setId("pnl_" + command.getId());
- @Override
- public UIComponent doCreateSearchFor(FieldInterface field)
- {
- HtmlPanelGroup panel = doCreatePanelGroupComponent();
-
- InputSuggestAjax cmp = new InputSuggestAjax();
- initInputDefaults(cmp, field);
-
- String dataSource = field.getDataSource();
- String dataSourceDescription = field.getDataSourceDescription();
-
- MethodBinding mbSearch = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
- dataSource,
- new Class[]
- {
- String.class
- });
- MethodBinding mbLabel = FacesContext.getCurrentInstance().getApplication().createMethodBinding(
- dataSourceDescription,
- new Class[]
- {
- field.getType()
- });
-
- cmp.setSuggestedItemsMethod(mbSearch);
- cmp.setItemLabelMethod(mbLabel);
-
- if (cmp.getConverter() == null)
- {
- cmp.setConverter(new ObjectSerializationConverter());
- }
-
- panel.getChildren().add(cmp);
- return panel;
-
- /*
- HtmlPanelGroup panel = doCreatePanelGroupComponent();
-
-
- HtmlCommandLink command = doCreateCommandLink(field);
- // avoid duplicate id
- command.setId("cmd_" + command.getId());
- command.setValue("...");
- command.setStyleClass("ff_searchLink");
- command.setImmediate(true);
-
- command.getChildren().add(
- createParameter(SEARCH_ENTITY_TYPE, field.getType().getName()));
- command.getChildren().add(
- createParameter(SEARCH_ENTITY_BINDING,
- createValueBindingString(field)));
-
- Converter converter = context.getApplication().createConverter(field.getType());
- HtmlOutputText text = doCreateOutputText(field);
- if (converter != null)
- {
- text.setConverter(converter);
- }
- panel.getChildren().add(text);
-
- panel.getChildren().add(command);
-
- panel.setId("pnl_" + command.getId());
-
- return panel;
- */
- }
+ return panel;
+ */
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/guiBuilder/impl/myfaces/SuggestSelectListMethodWrapper.java Thu Jul 3 14:58:05 2008
@@ -35,129 +35,129 @@
*/
public class SuggestSelectListMethodWrapper extends MethodBinding
{
- private final MethodBinding original;
- private final String valueProperty;
- private final String[] descriptionPropertiesArray;
-
- SuggestSelectListMethodWrapper(MethodBinding original, String valueProperty, String descriptionProperties)
- {
- this.original = original;
- this.valueProperty = valueProperty;
- if (descriptionProperties != null)
- {
- descriptionPropertiesArray = descriptionProperties.split(",\\s*");
- }
- else
- {
- descriptionPropertiesArray = new String[]{};
- }
- }
-
- @Override
- public Class getType(FacesContext facesContext) throws MethodNotFoundException
- {
- return List.class;
- }
-
- @Override
- public Object invoke(FacesContext facesContext, Object[] objects) throws EvaluationException
- {
- Object items = original.invoke(facesContext, objects);
- if (items == null)
- {
- return items;
- }
-
- if (!(items instanceof Collection))
- {
- throw new UnsupportedOperationException("unknown return type " + items.getClass().getName() + " for " + getExpressionString() + " awaited instanceof java.util.Collection");
- }
-
- Collection coll = (Collection) items;
-
- List<SelectItem> selectItems = new ArrayList<SelectItem>(coll.size());
- for (Object o : coll)
- {
- SelectItem si;
-
- if (o instanceof SelectItem)
- {
- si = (SelectItem) o;
- }
- else
- {
- Object value = getValueProperty(o, valueProperty);
- String description = buildDescription(o, descriptionPropertiesArray);
-
- si = new SelectItem(value, description);
- }
-
- selectItems.add(si);
- }
-
- return selectItems;
- }
-
- protected String buildDescription(Object o, String[] descriptionPropertiesArray)
- {
- StringBuffer sb = new StringBuffer(80);
-
- for (String descriptionProperty : descriptionPropertiesArray)
- {
- Object descriptionValue = null;
- try
- {
- descriptionValue = BeanUtils.getProperty(o, descriptionProperty);
- }
- catch (IllegalAccessException e)
- {
- throw new EvaluationException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new EvaluationException(e);
- }
- catch (NoSuchMethodException e)
- {
- throw new EvaluationException(e);
- }
-
- if (descriptionValue != null)
- {
- if (sb.length() > 0)
- {
- sb.append(", ");
- }
-
- sb.append(descriptionValue);
- }
- }
-
- return sb.toString();
- }
-
- protected Object getValueProperty(Object o, String valueProperty)
- {
- if (valueProperty == null || valueProperty.trim().length() < 1)
- {
- return o;
- }
-
- try
- {
- return BeanUtils.getProperty(o, valueProperty);
- }
- catch (IllegalAccessException e)
- {
- throw new EvaluationException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new EvaluationException(e);
- }
- catch (NoSuchMethodException e)
- {
- throw new EvaluationException(e);
- }
- }
+ private final MethodBinding original;
+ private final String valueProperty;
+ private final String[] descriptionPropertiesArray;
+
+ SuggestSelectListMethodWrapper(MethodBinding original, String valueProperty, String descriptionProperties)
+ {
+ this.original = original;
+ this.valueProperty = valueProperty;
+ if (descriptionProperties != null)
+ {
+ descriptionPropertiesArray = descriptionProperties.split(",\\s*");
+ }
+ else
+ {
+ descriptionPropertiesArray = new String[]{};
+ }
+ }
+
+ @Override
+ public Class getType(FacesContext facesContext) throws MethodNotFoundException
+ {
+ return List.class;
+ }
+
+ @Override
+ public Object invoke(FacesContext facesContext, Object[] objects) throws EvaluationException
+ {
+ Object items = original.invoke(facesContext, objects);
+ if (items == null)
+ {
+ return items;
+ }
+
+ if (!(items instanceof Collection))
+ {
+ throw new UnsupportedOperationException("unknown return type " + items.getClass().getName() + " for " + getExpressionString() + " awaited instanceof java.util.Collection");
+ }
+
+ Collection coll = (Collection) items;
+
+ List<SelectItem> selectItems = new ArrayList<SelectItem>(coll.size());
+ for (Object o : coll)
+ {
+ SelectItem si;
+
+ if (o instanceof SelectItem)
+ {
+ si = (SelectItem) o;
+ }
+ else
+ {
+ Object value = getValueProperty(o, valueProperty);
+ String description = buildDescription(o, descriptionPropertiesArray);
+
+ si = new SelectItem(value, description);
+ }
+
+ selectItems.add(si);
+ }
+
+ return selectItems;
+ }
+
+ protected String buildDescription(Object o, String[] descriptionPropertiesArray)
+ {
+ StringBuffer sb = new StringBuffer(80);
+
+ for (String descriptionProperty : descriptionPropertiesArray)
+ {
+ Object descriptionValue = null;
+ try
+ {
+ descriptionValue = BeanUtils.getProperty(o, descriptionProperty);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new EvaluationException(e);
+ }
+
+ if (descriptionValue != null)
+ {
+ if (sb.length() > 0)
+ {
+ sb.append(", ");
+ }
+
+ sb.append(descriptionValue);
+ }
+ }
+
+ return sb.toString();
+ }
+
+ protected Object getValueProperty(Object o, String valueProperty)
+ {
+ if (valueProperty == null || valueProperty.trim().length() < 1)
+ {
+ return o;
+ }
+
+ try
+ {
+ return BeanUtils.getProperty(o, valueProperty);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new EvaluationException(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new EvaluationException(e);
+ }
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/ComponentUtils.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/ComponentUtils.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/ComponentUtils.java Thu Jul 3 14:58:05 2008
@@ -26,14 +26,14 @@
public class ComponentUtils
{
- private ComponentUtils()
- {
- }
-
- public static void renderChildren(FacesContext context, UIComponent component)
- throws IOException
- {
- List children = component.getChildren();
+ private ComponentUtils()
+ {
+ }
+
+ public static void renderChildren(FacesContext context, UIComponent component)
+ throws IOException
+ {
+ List children = component.getChildren();
for (Object aChild : children)
{
UIComponent child = (UIComponent) aChild;
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/UIComponentTagUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/UIComponentTagUtils.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/UIComponentTagUtils.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/jsfext/UIComponentTagUtils.java Thu Jul 3 14:58:05 2008
@@ -25,28 +25,28 @@
public class UIComponentTagUtils
{
- public static boolean isValueReference(String v)
- {
- return UIComponentTag.isValueReference(v);
- }
+ public static boolean isValueReference(String v)
+ {
+ return UIComponentTag.isValueReference(v);
+ }
- @SuppressWarnings("unchecked")
- public static void setObjectProperty(FacesContext context,
- UIComponent component, String propName, Object value)
- {
- if (value != null)
- {
- if (value instanceof String
- && UIComponentTagUtils.isValueReference(value.toString()))
- {
- ValueBinding vb = context.getApplication().createValueBinding(
- value.toString());
- component.setValueBinding(propName, vb);
- }
- else
- {
- component.getAttributes().put(propName, value);
- }
- }
- }
+ @SuppressWarnings("unchecked")
+ public static void setObjectProperty(FacesContext context,
+ UIComponent component, String propName, Object value)
+ {
+ if (value != null)
+ {
+ if (value instanceof String
+ && UIComponentTagUtils.isValueReference(value.toString()))
+ {
+ ValueBinding vb = context.getApplication().createValueBinding(
+ value.toString());
+ component.setValueBinding(propName, vb);
+ }
+ else
+ {
+ component.getAttributes().put(propName, value);
+ }
+ }
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ConditionEnum.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ConditionEnum.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ConditionEnum.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ConditionEnum.java Thu Jul 3 14:58:05 2008
@@ -20,15 +20,15 @@
public enum ConditionEnum
{
- auto,
- eq,
- ne,
- gt,
- lt,
- ge,
- le,
- isNull,
- isNotNull,
- like,
- ilike
+ auto,
+ eq,
+ ne,
+ gt,
+ lt,
+ ge,
+ le,
+ isNull,
+ isNotNull,
+ like,
+ ilike
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DefaultValueMap.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DefaultValueMap.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DefaultValueMap.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DefaultValueMap.java Thu Jul 3 14:58:05 2008
@@ -25,97 +25,97 @@
public class DefaultValueMap<K, V> implements Map<K, V>, Serializable
{
- private static final long serialVersionUID = -1311019539599397096L;
-
- private final Map<K, V> original;
- private final DefaultValueFactory<V> defaultValueFactory;
-
- public static interface DefaultValueFactory<V> extends Serializable
- {
- public V create();
- }
-
- public DefaultValueMap(Map<K, V> original, DefaultValueFactory<V> defaultValueFactory)
- {
- this.original = original;
- this.defaultValueFactory = defaultValueFactory;
- }
-
- public void clear()
- {
- original.clear();
- }
-
- public boolean containsKey(Object key)
- {
- return original.containsKey(key);
- }
-
- public boolean containsValue(Object value)
- {
- return original.containsValue(value);
- }
-
- public Set<Entry<K, V>> entrySet()
- {
- return original.entrySet();
- }
-
- public boolean equals(Object o)
- {
- return original.equals(o);
- }
-
- @SuppressWarnings("unchecked")
- public V get(Object key)
- {
- V ret = original.get(key);
- if (ret == null)
- {
- ret = defaultValueFactory.create();
- original.put((K) key, ret);
- }
-
- return ret;
- }
-
- public int hashCode()
- {
- return original.hashCode();
- }
-
- public boolean isEmpty()
- {
- return original.isEmpty();
- }
-
- public Set<K> keySet()
- {
- return original.keySet();
- }
-
- public V put(K key, V value)
- {
- return original.put(key, value);
- }
-
- public void putAll(Map<? extends K, ? extends V> t)
- {
- original.putAll(t);
- }
-
- public V remove(Object key)
- {
- return original.remove(key);
- }
-
- public int size()
- {
- return original.size();
- }
-
- public Collection<V> values()
- {
- return original.values();
- }
+ private static final long serialVersionUID = -1311019539599397096L;
+
+ private final Map<K, V> original;
+ private final DefaultValueFactory<V> defaultValueFactory;
+
+ public static interface DefaultValueFactory<V> extends Serializable
+ {
+ public V create();
+ }
+
+ public DefaultValueMap(Map<K, V> original, DefaultValueFactory<V> defaultValueFactory)
+ {
+ this.original = original;
+ this.defaultValueFactory = defaultValueFactory;
+ }
+
+ public void clear()
+ {
+ original.clear();
+ }
+
+ public boolean containsKey(Object key)
+ {
+ return original.containsKey(key);
+ }
+
+ public boolean containsValue(Object value)
+ {
+ return original.containsValue(value);
+ }
+
+ public Set<Entry<K, V>> entrySet()
+ {
+ return original.entrySet();
+ }
+
+ public boolean equals(Object o)
+ {
+ return original.equals(o);
+ }
+
+ @SuppressWarnings("unchecked")
+ public V get(Object key)
+ {
+ V ret = original.get(key);
+ if (ret == null)
+ {
+ ret = defaultValueFactory.create();
+ original.put((K) key, ret);
+ }
+
+ return ret;
+ }
+
+ public int hashCode()
+ {
+ return original.hashCode();
+ }
+
+ public boolean isEmpty()
+ {
+ return original.isEmpty();
+ }
+
+ public Set<K> keySet()
+ {
+ return original.keySet();
+ }
+
+ public V put(K key, V value)
+ {
+ return original.put(key, value);
+ }
+
+ public void putAll(Map<? extends K, ? extends V> t)
+ {
+ original.putAll(t);
+ }
+
+ public V remove(Object key)
+ {
+ return original.remove(key);
+ }
+
+ public int size()
+ {
+ return original.size();
+ }
+
+ public Collection<V> values()
+ {
+ return original.values();
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DynaFormException.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DynaFormException.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DynaFormException.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/DynaFormException.java Thu Jul 3 14:58:05 2008
@@ -21,23 +21,23 @@
@SuppressWarnings("serial")
public class DynaFormException extends RuntimeException
{
- public DynaFormException()
- {
- super();
- }
+ public DynaFormException()
+ {
+ super();
+ }
- public DynaFormException(String message)
- {
- super(message);
- }
+ public DynaFormException(String message)
+ {
+ super(message);
+ }
- public DynaFormException(String message, Throwable cause)
- {
- super(message, cause);
- }
+ public DynaFormException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
- public DynaFormException(Throwable cause)
- {
- super(cause);
- }
+ public DynaFormException(Throwable cause)
+ {
+ super(cause);
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/MatchModeEnum.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/MatchModeEnum.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/MatchModeEnum.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/MatchModeEnum.java Thu Jul 3 14:58:05 2008
@@ -20,8 +20,8 @@
public enum MatchModeEnum
{
- none,
- start,
- end,
- anywhere
+ none,
+ start,
+ end,
+ anywhere
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/NullObject.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/NullObject.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/NullObject.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/NullObject.java Thu Jul 3 14:58:05 2008
@@ -22,15 +22,15 @@
public class NullObject implements Serializable
{
- private static final long serialVersionUID = -5631278744813815987L;
+ private static final long serialVersionUID = -5631278744813815987L;
- public NullObject()
- {
- }
+ public NullObject()
+ {
+ }
- @Override
- public boolean equals(Object obj)
- {
- return obj == null || obj instanceof NullObject;
- }
+ @Override
+ public boolean equals(Object obj)
+ {
+ return obj == null || obj instanceof NullObject;
+ }
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ObjectSerializationConverter.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ObjectSerializationConverter.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ObjectSerializationConverter.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ObjectSerializationConverter.java Thu Jul 3 14:58:05 2008
@@ -41,84 +41,84 @@
*/
public class ObjectSerializationConverter implements Converter
{
- public static final NullObject SELECT_NULL_OBJECT = new NullObject();
-
- public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException
- {
- if (value == null || value.length() < 1 || SELECT_NULL_OBJECT.equals(value))
- {
- return null;
- }
+ public static final NullObject SELECT_NULL_OBJECT = new NullObject();
+
+ public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException
+ {
+ if (value == null || value.length() < 1 || SELECT_NULL_OBJECT.equals(value))
+ {
+ return null;
+ }
- ObjectInputStream ois = null;
- Serializable objectIdent;
- try
- {
- byte[] base64 = Base64.decodeBase64(value.getBytes("UTF-8"));
- ois = new ObjectInputStream(new ByteArrayInputStream(base64));
- objectIdent = (Serializable) ois.readObject();
- ois.close();
- }
- catch (IOException e)
- {
- throw new ConverterException(e);
- }
- catch (ClassNotFoundException e)
- {
- throw new ConverterException(e);
- }
- finally
- {
- if (ois != null)
- {
- try
- {
- ois.close();
- }
- catch (IOException e)
- {
- // consume exception, should never happen
- }
- }
- }
-
- return objectIdent;
- }
+ ObjectInputStream ois = null;
+ Serializable objectIdent;
+ try
+ {
+ byte[] base64 = Base64.decodeBase64(value.getBytes("UTF-8"));
+ ois = new ObjectInputStream(new ByteArrayInputStream(base64));
+ objectIdent = (Serializable) ois.readObject();
+ ois.close();
+ }
+ catch (IOException e)
+ {
+ throw new ConverterException(e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ConverterException(e);
+ }
+ finally
+ {
+ if (ois != null)
+ {
+ try
+ {
+ ois.close();
+ }
+ catch (IOException e)
+ {
+ // consume exception, should never happen
+ }
+ }
+ }
+
+ return objectIdent;
+ }
- public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException
- {
- if (value == null || SELECT_NULL_OBJECT.equals(value))
- {
- return "";
- }
-
- ObjectOutputStream oos = null;
- try
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
- oos = new ObjectOutputStream(baos);
- oos.writeObject(value);
- byte[] base64 = Base64.encodeBase64(baos.toByteArray());
- String objectString = new String(base64, "UTF-8");
- return objectString;
- }
- catch (IOException e)
- {
- throw new ConverterException(e);
- }
- finally
- {
- if (oos != null)
- {
- try
- {
- oos.close();
- }
- catch (IOException e)
- {
- // consume exception, should never happen
- }
- }
- }
- }
+ public String getAsString(FacesContext context, UIComponent component, Object value) throws ConverterException
+ {
+ if (value == null || SELECT_NULL_OBJECT.equals(value))
+ {
+ return "";
+ }
+
+ ObjectOutputStream oos = null;
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ oos = new ObjectOutputStream(baos);
+ oos.writeObject(value);
+ byte[] base64 = Base64.encodeBase64(baos.toByteArray());
+ String objectString = new String(base64, "UTF-8");
+ return objectString;
+ }
+ catch (IOException e)
+ {
+ throw new ConverterException(e);
+ }
+ finally
+ {
+ if (oos != null)
+ {
+ try
+ {
+ oos.close();
+ }
+ catch (IOException e)
+ {
+ // consume exception, should never happen
+ }
+ }
+ }
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/OrderDirectionEnum.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/OrderDirectionEnum.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/OrderDirectionEnum.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/OrderDirectionEnum.java Thu Jul 3 14:58:05 2008
@@ -20,6 +20,6 @@
public enum OrderDirectionEnum
{
- asc,
- desc
+ asc,
+ desc
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionSourceEnum.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionSourceEnum.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionSourceEnum.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionSourceEnum.java Thu Jul 3 14:58:05 2008
@@ -20,7 +20,7 @@
public enum SelectionSourceEnum
{
- manual,
- relation,
- distinct
+ manual,
+ relation,
+ distinct
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionTypeEnum.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionTypeEnum.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionTypeEnum.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/SelectionTypeEnum.java Thu Jul 3 14:58:05 2008
@@ -20,7 +20,7 @@
public enum SelectionTypeEnum
{
- none,
- one,
- many
+ none,
+ one,
+ many
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ViewType.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ViewType.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ViewType.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/lib/ViewType.java Thu Jul 3 14:58:05 2008
@@ -20,6 +20,6 @@
public enum ViewType
{
- FORM,
- LIST
+ FORM,
+ LIST
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Extractor.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Extractor.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Extractor.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Extractor.java Thu Jul 3 14:58:05 2008
@@ -23,8 +23,8 @@
*/
public interface Extractor
{
- /**
- * get the metadata for the given entity
- */
- public void getMetaData(MetaData metaData, Object entity);
+ /**
+ * get the metadata for the given entity
+ */
+ public void getMetaData(MetaData metaData, Object entity);
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/FieldInterface.java Thu Jul 3 14:58:05 2008
@@ -26,44 +26,44 @@
public interface FieldInterface
{
- public String getName();
- public String getBaseName();
- public String getExternalName();
- public Class getType();
- public boolean isEntityType();
- public Boolean getDisabled();
- public Boolean getCanRead();
- public Boolean getCanWrite();
- public Boolean getDisplayOnly();
- public boolean getRequired();
- public Selection[] getAllowedSelections();
- public RelationType getRelationType();
+ public String getName();
+ public String getBaseName();
+ public String getExternalName();
+ public Class getType();
+ public boolean isEntityType();
+ public Boolean getDisabled();
+ public Boolean getCanRead();
+ public Boolean getCanWrite();
+ public Boolean getDisplayOnly();
+ public boolean getRequired();
+ public Selection[] getAllowedSelections();
+ public RelationType getRelationType();
- /**
- * in case of hierarchical structures this defines if a child class should be treatened
- * as "embedded".<br />
- * <ul>
- * <li>Embedded: like a composite key in hibernate</li>
- * <li>Not Embedded: like a relation to another entity (ManyToOne)</li>
- * </ul>
- * This is not a metadata for the field itself, but for the context in which this field
- * (or its entity) will be used
- */
- public boolean isEmbedded();
+ /**
+ * in case of hierarchical structures this defines if a child class should be treatened
+ * as "embedded".<br />
+ * <ul>
+ * <li>Embedded: like a composite key in hibernate</li>
+ * <li>Not Embedded: like a relation to another entity (ManyToOne)</li>
+ * </ul>
+ * This is not a metadata for the field itself, but for the context in which this field
+ * (or its entity) will be used
+ */
+ public boolean isEmbedded();
- public Integer getMaxSize();
- public Double getMaxValue();
- public Integer getMinSize();
- public Integer getDisplaySize();
- public Double getMinValue();
- public UIComponent getWantedComponent();
- public ComponentEnum getWantedComponentType();
- public TemporalType getTemporalType();
- public boolean getAllowMultipleSelections();
- public SelectionSourceEnum getSelectionSource();
+ public Integer getMaxSize();
+ public Double getMaxValue();
+ public Integer getMinSize();
+ public Integer getDisplaySize();
+ public Double getMinValue();
+ public UIComponent getWantedComponent();
+ public ComponentEnum getWantedComponentType();
+ public TemporalType getTemporalType();
+ public boolean getAllowMultipleSelections();
+ public SelectionSourceEnum getSelectionSource();
- public String getDataSource();
- public String getDataSourceDescription();
- public String getConverterId();
- public Class getConverterClass();
+ public String getDataSource();
+ public String getDataSourceDescription();
+ public String getConverterId();
+ public Class getConverterClass();
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaData.java Thu Jul 3 14:58:05 2008
@@ -37,443 +37,443 @@
*/
public class MetaData implements MetaDataInterface
{
- private final Set<String> requestedFields = new TreeSet<String>();
- private final Set<String> requestedFieldParents = new TreeSet<String>();
- private final Map<String, FieldImpl> fields = new LinkedHashMap<String, FieldImpl>();
-
- private boolean lockFields = false;
-
- /**
- * Metadata for a field
- */
- public static class FieldImpl implements FieldInterface, Serializable
- {
- private final String name;
- private final String baseName;
- private String preferredExternalName;
- private Class type;
- private boolean entityType;
- private Boolean canRead;
- private Boolean canWrite;
- private Boolean disabled;
- private Boolean displayOnly;
- private boolean required;
- private RelationType relationType = RelationType.NONE;
- private boolean embedded = true;
- private Integer displaySize;
- private Integer minSize;
- private Integer maxSize;
- private Double minValue;
- private Double maxValue;
- private TemporalType temporalType;
-
- private Selection[] allowedSelection;
- private boolean allowMultipleSelections;
- private SelectionSourceEnum selectionSource;
-
- private UIComponent wantedComponent;
- private ComponentEnum wantedComponentType = ComponentEnum.Automatic;
-
- private String dataSource;
- private String dataSourceDescription;
-
- private String converterId;
- private Class converterClass;
-
- protected FieldImpl(String name)
- {
- this.name = name;
- int pos = name.lastIndexOf('.');
- if (pos > -1)
- {
- this.baseName = name.substring(pos+1);
- }
- else
- {
- this.baseName = name;
- }
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getBaseName()
- {
- return baseName;
- }
-
- public String getExternalName()
- {
- if (getPreferredExternalName() != null)
- {
- return getPreferredExternalName();
- }
-
- return getName();
- }
-
- public String getPreferredExternalName()
- {
- return preferredExternalName;
- }
-
- public void setPreferredExternalName(String preferredExternalName)
- {
- this.preferredExternalName = preferredExternalName;
- }
-
- public Class getType()
- {
- return type;
- }
-
- public void setType(Class type)
- {
- if (this.type != null && this.type != type)
- {
- throw new IllegalArgumentException("" + name
- + ": reset with different type denied. curr:"
- + this.type.getName() + " new:" + type.getName());
- }
- this.type = type;
- }
-
- public Boolean getDisplayOnly()
- {
- return displayOnly;
- }
-
- public void setDisplayOnly(Boolean displayOnly)
- {
- this.displayOnly = displayOnly;
- }
-
- public boolean isCanRead()
- {
- return getCanRead() != null && getCanRead().booleanValue();
- }
-
- public void setCanRead(boolean canRead)
- {
- this.canRead = canRead;
- }
-
- public Boolean getCanRead()
- {
- return this.canRead;
- }
-
- public void setCanWrite(boolean canWrite)
- {
- this.canWrite = canWrite;
- }
-
- public Boolean getCanWrite()
- {
- return canWrite;
- }
-
- public void setDisabled(boolean disabled)
- {
- this.disabled = disabled;
- }
-
- public Boolean getDisabled()
- {
- return disabled;
- }
-
- public boolean getRequired()
- {
- return required;
- }
-
- public void setRequired(boolean nullable)
- {
- this.required = nullable;
- }
-
- public Selection[] getAllowedSelections()
- {
- return allowedSelection;
- }
-
- public void setAllowedSelections(Selection[] allowedSelections)
- {
- this.allowedSelection = allowedSelections;
- }
-
- public RelationType getRelationType()
- {
- return relationType;
- }
-
- public void setRelationType(RelationType relationType)
- {
- this.relationType = relationType;
- }
-
- public Integer getMaxSize()
- {
- return maxSize;
- }
-
- public void setMaxSize(Integer maxSize)
- {
- this.maxSize = maxSize;
- }
-
- public Double getMaxValue()
- {
- return maxValue;
- }
-
- public void setMaxValue(Double maxValue)
- {
- this.maxValue = maxValue;
- }
-
- public Integer getMinSize()
- {
- return minSize;
- }
-
- public void setMinSize(Integer minSize)
- {
- this.minSize = minSize;
- }
-
- public Double getMinValue()
- {
- return minValue;
- }
-
- public void setMinValue(Double minValue)
- {
- this.minValue = minValue;
- }
-
- public void setWantedComponent(UIComponent component)
- {
- this.wantedComponent = component;
- }
-
- public UIComponent getWantedComponent()
- {
- return wantedComponent;
- }
-
- public void setWantedComponentType(ComponentEnum componentType)
- {
- this.wantedComponentType = componentType;
- }
-
- public ComponentEnum getWantedComponentType()
- {
- return this.wantedComponentType;
- }
-
- public void setDisplaySize(int displaySize)
- {
- this.displaySize = displaySize;
- }
-
- public Integer getDisplaySize()
- {
- return displaySize;
- }
-
- public void setTemporalType(TemporalType temporalType)
- {
- this.temporalType = temporalType;
- }
-
- public TemporalType getTemporalType()
- {
- return temporalType;
- }
-
- public boolean getAllowMultipleSelections()
- {
- return allowMultipleSelections;
- }
-
- public void setAllowMultipleSelections(boolean allowMultipleSelections)
- {
- this.allowMultipleSelections = allowMultipleSelections;
- }
-
- public SelectionSourceEnum getSelectionSource()
- {
- return selectionSource;
- }
-
- public void setSelectionSource(SelectionSourceEnum selectionSource)
- {
- this.selectionSource = selectionSource;
- }
-
- public boolean isEntityType()
- {
- return entityType;
- }
-
- public void setEntityType(boolean entityType)
- {
- this.entityType = entityType;
- }
-
- public boolean isEmbedded()
- {
- return embedded;
- }
-
- public void setEmbedded(boolean embedded)
- {
- this.embedded = embedded;
- }
-
- public String getDataSource()
- {
- return dataSource;
- }
-
- public void setDataSource(String dataSource)
- {
- this.dataSource = dataSource;
- }
-
- public String getDataSourceDescription()
- {
- return dataSourceDescription;
- }
-
- public void setDataSourceDescription(String dataSourceDescription)
- {
- this.dataSourceDescription = dataSourceDescription;
- }
-
- public String getConverterId()
- {
- return converterId;
- }
-
- public void setConverterId(String converterId)
- {
- this.converterId = converterId;
- }
-
- public Class getConverterClass()
- {
- return converterClass;
- }
-
- public void setConverterClass(Class converterClass)
- {
- this.converterClass = converterClass;
- }
- }
-
- public MetaData()
- {
- }
-
- /**
- * should this field be processed
- *
- * @see #setLockFields(boolean)
- */
- public boolean processField(String name)
- {
- return !lockFields || processFieldParent(name) || requestedFields.contains(name) || fields.containsKey(name);
- }
-
- /**
- * should this field be processed.
- *
- * @return true if the given name is the parent of one of the requestedFields
- * @see #processField(String)
- * @see #setLockFields(boolean)
- */
- public boolean processFieldParent(String name)
- {
- return requestedFieldParents.contains(name);
- }
-
- /**
- * request to add this field if we reach it. eg. used to trigger traversing the object graph for
- * linked entities
- */
- public void requestField(String name)
- {
- int currIndex = name.indexOf('.');
- while (currIndex > -1)
- {
- String key = name.substring(0, currIndex);
- if (!requestedFieldParents.contains(key))
- {
- requestedFieldParents.add(key);
- }
- currIndex = name.indexOf('.', currIndex+1);
- }
-
- requestedFields.add(name);
- }
-
- public Set<String> getRequestedFields()
- {
- return Collections.unmodifiableSet(requestedFields);
- }
-
- /**
- * add a new field to the metadata or return one if one already exists for
- * the given name
- */
- public FieldImpl getOrCreateField(String name)
- {
- if (!processField(name))
- {
- throw new SecurityException("Current state do not allow to add the field: " + name);
- }
-
- FieldImpl field = fields.get(name);
- if (field == null)
- {
- field = new FieldImpl(name);
- fields.put(name, field);
- }
- return field;
- }
-
- public int getFieldCount()
- {
- return fields.size();
- }
-
- public Iterator<String> iterFieldNames()
- {
- return fields.keySet().iterator();
- }
-
- public FieldInterface getField(String name)
- {
- return fields.get(name);
- }
-
- public String[] getFieldNames()
- {
- return fields.keySet().toArray(new String[fields.size()]);
- }
-
- /**
- * if set to true this avoids any field to be newly created, only already existent fields are to be processed
- */
- public boolean setLockFields(boolean lockFields)
- {
- boolean prev = this.lockFields;
- this.lockFields = lockFields;
- return prev;
- }
+ private final Set<String> requestedFields = new TreeSet<String>();
+ private final Set<String> requestedFieldParents = new TreeSet<String>();
+ private final Map<String, FieldImpl> fields = new LinkedHashMap<String, FieldImpl>();
+
+ private boolean lockFields = false;
+
+ /**
+ * Metadata for a field
+ */
+ public static class FieldImpl implements FieldInterface, Serializable
+ {
+ private final String name;
+ private final String baseName;
+ private String preferredExternalName;
+ private Class type;
+ private boolean entityType;
+ private Boolean canRead;
+ private Boolean canWrite;
+ private Boolean disabled;
+ private Boolean displayOnly;
+ private boolean required;
+ private RelationType relationType = RelationType.NONE;
+ private boolean embedded = true;
+ private Integer displaySize;
+ private Integer minSize;
+ private Integer maxSize;
+ private Double minValue;
+ private Double maxValue;
+ private TemporalType temporalType;
+
+ private Selection[] allowedSelection;
+ private boolean allowMultipleSelections;
+ private SelectionSourceEnum selectionSource;
+
+ private UIComponent wantedComponent;
+ private ComponentEnum wantedComponentType = ComponentEnum.Automatic;
+
+ private String dataSource;
+ private String dataSourceDescription;
+
+ private String converterId;
+ private Class converterClass;
+
+ protected FieldImpl(String name)
+ {
+ this.name = name;
+ int pos = name.lastIndexOf('.');
+ if (pos > -1)
+ {
+ this.baseName = name.substring(pos+1);
+ }
+ else
+ {
+ this.baseName = name;
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getBaseName()
+ {
+ return baseName;
+ }
+
+ public String getExternalName()
+ {
+ if (getPreferredExternalName() != null)
+ {
+ return getPreferredExternalName();
+ }
+
+ return getName();
+ }
+
+ public String getPreferredExternalName()
+ {
+ return preferredExternalName;
+ }
+
+ public void setPreferredExternalName(String preferredExternalName)
+ {
+ this.preferredExternalName = preferredExternalName;
+ }
+
+ public Class getType()
+ {
+ return type;
+ }
+
+ public void setType(Class type)
+ {
+ if (this.type != null && this.type != type)
+ {
+ throw new IllegalArgumentException("" + name
+ + ": reset with different type denied. curr:"
+ + this.type.getName() + " new:" + type.getName());
+ }
+ this.type = type;
+ }
+
+ public Boolean getDisplayOnly()
+ {
+ return displayOnly;
+ }
+
+ public void setDisplayOnly(Boolean displayOnly)
+ {
+ this.displayOnly = displayOnly;
+ }
+
+ public boolean isCanRead()
+ {
+ return getCanRead() != null && getCanRead().booleanValue();
+ }
+
+ public void setCanRead(boolean canRead)
+ {
+ this.canRead = canRead;
+ }
+
+ public Boolean getCanRead()
+ {
+ return this.canRead;
+ }
+
+ public void setCanWrite(boolean canWrite)
+ {
+ this.canWrite = canWrite;
+ }
+
+ public Boolean getCanWrite()
+ {
+ return canWrite;
+ }
+
+ public void setDisabled(boolean disabled)
+ {
+ this.disabled = disabled;
+ }
+
+ public Boolean getDisabled()
+ {
+ return disabled;
+ }
+
+ public boolean getRequired()
+ {
+ return required;
+ }
+
+ public void setRequired(boolean nullable)
+ {
+ this.required = nullable;
+ }
+
+ public Selection[] getAllowedSelections()
+ {
+ return allowedSelection;
+ }
+
+ public void setAllowedSelections(Selection[] allowedSelections)
+ {
+ this.allowedSelection = allowedSelections;
+ }
+
+ public RelationType getRelationType()
+ {
+ return relationType;
+ }
+
+ public void setRelationType(RelationType relationType)
+ {
+ this.relationType = relationType;
+ }
+
+ public Integer getMaxSize()
+ {
+ return maxSize;
+ }
+
+ public void setMaxSize(Integer maxSize)
+ {
+ this.maxSize = maxSize;
+ }
+
+ public Double getMaxValue()
+ {
+ return maxValue;
+ }
+
+ public void setMaxValue(Double maxValue)
+ {
+ this.maxValue = maxValue;
+ }
+
+ public Integer getMinSize()
+ {
+ return minSize;
+ }
+
+ public void setMinSize(Integer minSize)
+ {
+ this.minSize = minSize;
+ }
+
+ public Double getMinValue()
+ {
+ return minValue;
+ }
+
+ public void setMinValue(Double minValue)
+ {
+ this.minValue = minValue;
+ }
+
+ public void setWantedComponent(UIComponent component)
+ {
+ this.wantedComponent = component;
+ }
+
+ public UIComponent getWantedComponent()
+ {
+ return wantedComponent;
+ }
+
+ public void setWantedComponentType(ComponentEnum componentType)
+ {
+ this.wantedComponentType = componentType;
+ }
+
+ public ComponentEnum getWantedComponentType()
+ {
+ return this.wantedComponentType;
+ }
+
+ public void setDisplaySize(int displaySize)
+ {
+ this.displaySize = displaySize;
+ }
+
+ public Integer getDisplaySize()
+ {
+ return displaySize;
+ }
+
+ public void setTemporalType(TemporalType temporalType)
+ {
+ this.temporalType = temporalType;
+ }
+
+ public TemporalType getTemporalType()
+ {
+ return temporalType;
+ }
+
+ public boolean getAllowMultipleSelections()
+ {
+ return allowMultipleSelections;
+ }
+
+ public void setAllowMultipleSelections(boolean allowMultipleSelections)
+ {
+ this.allowMultipleSelections = allowMultipleSelections;
+ }
+
+ public SelectionSourceEnum getSelectionSource()
+ {
+ return selectionSource;
+ }
+
+ public void setSelectionSource(SelectionSourceEnum selectionSource)
+ {
+ this.selectionSource = selectionSource;
+ }
+
+ public boolean isEntityType()
+ {
+ return entityType;
+ }
+
+ public void setEntityType(boolean entityType)
+ {
+ this.entityType = entityType;
+ }
+
+ public boolean isEmbedded()
+ {
+ return embedded;
+ }
+
+ public void setEmbedded(boolean embedded)
+ {
+ this.embedded = embedded;
+ }
+
+ public String getDataSource()
+ {
+ return dataSource;
+ }
+
+ public void setDataSource(String dataSource)
+ {
+ this.dataSource = dataSource;
+ }
+
+ public String getDataSourceDescription()
+ {
+ return dataSourceDescription;
+ }
+
+ public void setDataSourceDescription(String dataSourceDescription)
+ {
+ this.dataSourceDescription = dataSourceDescription;
+ }
+
+ public String getConverterId()
+ {
+ return converterId;
+ }
+
+ public void setConverterId(String converterId)
+ {
+ this.converterId = converterId;
+ }
+
+ public Class getConverterClass()
+ {
+ return converterClass;
+ }
+
+ public void setConverterClass(Class converterClass)
+ {
+ this.converterClass = converterClass;
+ }
+ }
+
+ public MetaData()
+ {
+ }
+
+ /**
+ * should this field be processed
+ *
+ * @see #setLockFields(boolean)
+ */
+ public boolean processField(String name)
+ {
+ return !lockFields || processFieldParent(name) || requestedFields.contains(name) || fields.containsKey(name);
+ }
+
+ /**
+ * should this field be processed.
+ *
+ * @return true if the given name is the parent of one of the requestedFields
+ * @see #processField(String)
+ * @see #setLockFields(boolean)
+ */
+ public boolean processFieldParent(String name)
+ {
+ return requestedFieldParents.contains(name);
+ }
+
+ /**
+ * request to add this field if we reach it. eg. used to trigger traversing the object graph for
+ * linked entities
+ */
+ public void requestField(String name)
+ {
+ int currIndex = name.indexOf('.');
+ while (currIndex > -1)
+ {
+ String key = name.substring(0, currIndex);
+ if (!requestedFieldParents.contains(key))
+ {
+ requestedFieldParents.add(key);
+ }
+ currIndex = name.indexOf('.', currIndex+1);
+ }
+
+ requestedFields.add(name);
+ }
+
+ public Set<String> getRequestedFields()
+ {
+ return Collections.unmodifiableSet(requestedFields);
+ }
+
+ /**
+ * add a new field to the metadata or return one if one already exists for
+ * the given name
+ */
+ public FieldImpl getOrCreateField(String name)
+ {
+ if (!processField(name))
+ {
+ throw new SecurityException("Current state do not allow to add the field: " + name);
+ }
+
+ FieldImpl field = fields.get(name);
+ if (field == null)
+ {
+ field = new FieldImpl(name);
+ fields.put(name, field);
+ }
+ return field;
+ }
+
+ public int getFieldCount()
+ {
+ return fields.size();
+ }
+
+ public Iterator<String> iterFieldNames()
+ {
+ return fields.keySet().iterator();
+ }
+
+ public FieldInterface getField(String name)
+ {
+ return fields.get(name);
+ }
+
+ public String[] getFieldNames()
+ {
+ return fields.keySet().toArray(new String[fields.size()]);
+ }
+
+ /**
+ * if set to true this avoids any field to be newly created, only already existent fields are to be processed
+ */
+ public boolean setLockFields(boolean lockFields)
+ {
+ boolean prev = this.lockFields;
+ this.lockFields = lockFields;
+ return prev;
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaDataInterface.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaDataInterface.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaDataInterface.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/MetaDataInterface.java Thu Jul 3 14:58:05 2008
@@ -22,23 +22,23 @@
public interface MetaDataInterface
{
- /**
- * number of fields
- */
- public int getFieldCount();
+ /**
+ * number of fields
+ */
+ public int getFieldCount();
- /**
- * iterate through fields
- */
- public Iterator<String> iterFieldNames();
+ /**
+ * iterate through fields
+ */
+ public Iterator<String> iterFieldNames();
- /**
- * get the field by name
- */
- public FieldInterface getField(String name);
+ /**
+ * get the field by name
+ */
+ public FieldInterface getField(String name);
- /**
- * get all fields names
- */
- public String[] getFieldNames();
+ /**
+ * get all fields names
+ */
+ public String[] getFieldNames();
}
\ No newline at end of file
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/RelationType.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/RelationType.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/RelationType.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/RelationType.java Thu Jul 3 14:58:05 2008
@@ -20,9 +20,9 @@
public enum RelationType
{
- NONE,
- ONE_TO_ONE,
- ONE_TO_MANY,
- MANY_TO_ONE,
- MANY_TO_MANY
+ NONE,
+ ONE_TO_ONE,
+ ONE_TO_MANY,
+ MANY_TO_ONE,
+ MANY_TO_MANY
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Selection.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Selection.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Selection.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/Selection.java Thu Jul 3 14:58:05 2008
@@ -25,33 +25,33 @@
*/
public class Selection implements Serializable
{
- private final String label;
- private final Object value;
+ private final String label;
+ private final Object value;
- /**
- * let the gui determine how to display this value
- */
- public Selection(Object value)
- {
- this(null, value);
- }
+ /**
+ * let the gui determine how to display this value
+ */
+ public Selection(Object value)
+ {
+ this(null, value);
+ }
- /**
- * selection with fixed label
- */
- public Selection(String label, Object value)
- {
- this.label = label;
- this.value = value;
- }
+ /**
+ * selection with fixed label
+ */
+ public Selection(String label, Object value)
+ {
+ this.label = label;
+ this.value = value;
+ }
- public String getLabel()
- {
- return label;
- }
+ public String getLabel()
+ {
+ return label;
+ }
- public Object getValue()
- {
- return value;
- }
+ public Object getValue()
+ {
+ return value;
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/BcelHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/BcelHelper.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/BcelHelper.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/BcelHelper.java Thu Jul 3 14:58:05 2008
@@ -39,136 +39,136 @@
*/
public class BcelHelper implements ClassHelper
{
- public Field[] getFields(Class clazz)
- {
- JavaClass javaClass = Repository.lookupClass(clazz);
- org.apache.bcel.classfile.Field[] fields = javaClass.getFields();
-
- List<Field> ret = new ArrayList<Field>(fields.length);
- for (org.apache.bcel.classfile.Field field : fields)
- {
- try
- {
- ret.add(clazz.getDeclaredField(field.getName()));
- }
- catch (SecurityException e)
- {
- throw new DynaFormException(e);
- }
- catch (NoSuchFieldException e)
- {
- throw new DynaFormException(e);
- }
- }
- return ret.toArray(new Field[ret.size()]);
- }
+ public Field[] getFields(Class clazz)
+ {
+ JavaClass javaClass = Repository.lookupClass(clazz);
+ org.apache.bcel.classfile.Field[] fields = javaClass.getFields();
+
+ List<Field> ret = new ArrayList<Field>(fields.length);
+ for (org.apache.bcel.classfile.Field field : fields)
+ {
+ try
+ {
+ ret.add(clazz.getDeclaredField(field.getName()));
+ }
+ catch (SecurityException e)
+ {
+ throw new DynaFormException(e);
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new DynaFormException(e);
+ }
+ }
+ return ret.toArray(new Field[ret.size()]);
+ }
- public Method[] getMethods(Class clazz)
- {
- JavaClass javaClass = Repository.lookupClass(clazz);
- org.apache.bcel.classfile.Method[] methods = javaClass.getMethods();
-
- List<Method> ret = new ArrayList<Method>(methods.length);
- for (org.apache.bcel.classfile.Method method : methods)
- {
- if ("<init>".equals(method.getName()))
- {
- continue;
- }
- if (!method.getName().startsWith("set") && !method.getName().startsWith("get") && !method.getName().startsWith("is"))
- {
- continue;
- }
-
- Type[] types = method.getArgumentTypes();
- Class[] args = new Class[types.length];
- for (int i = 0; i<types.length; i++)
- {
- args[i] = type2Class(types[i]);
- }
-
- try
- {
- ret.add(clazz.getDeclaredMethod(method.getName(), args));
- }
- catch (SecurityException e)
- {
- throw new DynaFormException(e);
- }
- catch (NoSuchMethodException e)
- {
- throw new DynaFormException(e);
- }
- }
- return ret.toArray(new Method[ret.size()]);
- }
+ public Method[] getMethods(Class clazz)
+ {
+ JavaClass javaClass = Repository.lookupClass(clazz);
+ org.apache.bcel.classfile.Method[] methods = javaClass.getMethods();
+
+ List<Method> ret = new ArrayList<Method>(methods.length);
+ for (org.apache.bcel.classfile.Method method : methods)
+ {
+ if ("<init>".equals(method.getName()))
+ {
+ continue;
+ }
+ if (!method.getName().startsWith("set") && !method.getName().startsWith("get") && !method.getName().startsWith("is"))
+ {
+ continue;
+ }
+
+ Type[] types = method.getArgumentTypes();
+ Class[] args = new Class[types.length];
+ for (int i = 0; i<types.length; i++)
+ {
+ args[i] = type2Class(types[i]);
+ }
+
+ try
+ {
+ ret.add(clazz.getDeclaredMethod(method.getName(), args));
+ }
+ catch (SecurityException e)
+ {
+ throw new DynaFormException(e);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new DynaFormException(e);
+ }
+ }
+ return ret.toArray(new Method[ret.size()]);
+ }
- protected Class type2Class(Type type)
- {
- if (type instanceof BasicType)
- {
- BasicType basicType = (BasicType) type;
- if (basicType.getType() == BasicType.BOOLEAN.getType())
- {
- return boolean.class;
- }
- else if (basicType.getType() == BasicType.BYTE.getType())
- {
- return byte.class;
- }
- else if (basicType.getType() == BasicType.CHAR.getType())
- {
- return char.class;
- }
- else if (basicType.getType() == BasicType.DOUBLE.getType())
- {
- return double.class;
- }
- else if (basicType.getType() == BasicType.FLOAT.getType())
- {
- return float.class;
- }
- else if (basicType.getType() == BasicType.INT.getType())
- {
- return int.class;
- }
- else if (basicType.getType() == BasicType.LONG.getType())
- {
- return long.class;
- }
- else if (basicType.getType() == BasicType.SHORT.getType())
- {
- return short.class;
- }
- else if (basicType.getType() == BasicType.STRING.getType())
- {
- return String.class;
- }
- else if (basicType.getType() == BasicType.VOID.getType())
- {
- return void.class;
- }
- throw new IllegalArgumentException("dont know how to map " + basicType);
- }
- else if (type instanceof ObjectType)
- {
- ObjectType objectType = (ObjectType) type;
- try
- {
- return Class.forName(objectType.getClassName());
- }
- catch (ClassNotFoundException e)
- {
- throw new DynaFormException(e);
- }
- }
- else if (type instanceof ArrayType)
- {
- Class elementType = type2Class(((ArrayType) type).getElementType());
- return Array.newInstance(elementType, 0).getClass();
- }
-
- throw new IllegalArgumentException("unkown type " + type);
- }
+ protected Class type2Class(Type type)
+ {
+ if (type instanceof BasicType)
+ {
+ BasicType basicType = (BasicType) type;
+ if (basicType.getType() == BasicType.BOOLEAN.getType())
+ {
+ return boolean.class;
+ }
+ else if (basicType.getType() == BasicType.BYTE.getType())
+ {
+ return byte.class;
+ }
+ else if (basicType.getType() == BasicType.CHAR.getType())
+ {
+ return char.class;
+ }
+ else if (basicType.getType() == BasicType.DOUBLE.getType())
+ {
+ return double.class;
+ }
+ else if (basicType.getType() == BasicType.FLOAT.getType())
+ {
+ return float.class;
+ }
+ else if (basicType.getType() == BasicType.INT.getType())
+ {
+ return int.class;
+ }
+ else if (basicType.getType() == BasicType.LONG.getType())
+ {
+ return long.class;
+ }
+ else if (basicType.getType() == BasicType.SHORT.getType())
+ {
+ return short.class;
+ }
+ else if (basicType.getType() == BasicType.STRING.getType())
+ {
+ return String.class;
+ }
+ else if (basicType.getType() == BasicType.VOID.getType())
+ {
+ return void.class;
+ }
+ throw new IllegalArgumentException("dont know how to map " + basicType);
+ }
+ else if (type instanceof ObjectType)
+ {
+ ObjectType objectType = (ObjectType) type;
+ try
+ {
+ return Class.forName(objectType.getClassName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new DynaFormException(e);
+ }
+ }
+ else if (type instanceof ArrayType)
+ {
+ Class elementType = type2Class(((ArrayType) type).getElementType());
+ return Array.newInstance(elementType, 0).getClass();
+ }
+
+ throw new IllegalArgumentException("unkown type " + type);
+ }
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelper.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelper.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelper.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelper.java Thu Jul 3 14:58:05 2008
@@ -26,6 +26,6 @@
*/
public interface ClassHelper
{
- public Field[] getFields(Class clazz);
- public Method[] getMethods(Class clazz);
+ public Field[] getFields(Class clazz);
+ public Method[] getMethods(Class clazz);
}
Modified: myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelperFactory.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelperFactory.java?rev=673833&r1=673832&r2=673833&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelperFactory.java (original)
+++ myfaces/tomahawk/trunk/sandbox15/core/src/main/java/org/apache/myfaces/custom/dynaForm/metadata/impl/ejb/ClassHelperFactory.java Thu Jul 3 14:58:05 2008
@@ -20,37 +20,37 @@
public class ClassHelperFactory
{
- private static ClassHelper classHelper = null;
-
- private ClassHelperFactory()
- {
- }
-
- public static ClassHelper get()
- {
- if (classHelper != null)
- {
- return classHelper;
- }
-
- classHelper = create();
-
- return classHelper;
- }
+ private static ClassHelper classHelper = null;
+
+ private ClassHelperFactory()
+ {
+ }
+
+ public static ClassHelper get()
+ {
+ if (classHelper != null)
+ {
+ return classHelper;
+ }
+
+ classHelper = create();
+
+ return classHelper;
+ }
- private static ClassHelper create()
- {
- try
- {
- Class.forName("org.apache.bcel.classfile.JavaClass");
- return new BcelHelper();
- }
- catch (ClassNotFoundException e)
- {
+ private static ClassHelper create()
+ {
+ try
+ {
+ Class.forName("org.apache.bcel.classfile.JavaClass");
+ return new BcelHelper();
+ }
+ catch (ClassNotFoundException e)
+ {
// bcel not there
}
-
- // last exit
- return new JavaHelper();
- }
+
+ // last exit
+ return new JavaHelper();
+ }
}