Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2010-03-18 20:09:29 +0000
committercbateman2010-03-18 20:09:29 +0000
commitc5508b2c0f682bd88e2de65cba9ca7ad321b0844 (patch)
tree3c1200f0eaad7845316b00b112ab2a795ae44ac5
parent037f1243b0853a48714788a12ab4c3f7498dca6c (diff)
downloadwebtools.jsf-c5508b2c0f682bd88e2de65cba9ca7ad321b0844.tar.gz
webtools.jsf-c5508b2c0f682bd88e2de65cba9ca7ad321b0844.tar.xz
webtools.jsf-c5508b2c0f682bd88e2de65cba9ca7ad321b0844.zip
Fix serialization error for TLDTagAttribute by splitting out object data into serializable and wrapper objects as we do in TLDTagElement.
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java177
1 files changed, 165 insertions, 12 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java
index 4a284e87b..94ac59948 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/view/model/jsp/TLDTagAttribute.java
@@ -1,5 +1,8 @@
package org.eclipse.jst.jsf.designtime.internal.view.model.jsp;
+import java.io.IOException;
+import java.io.Serializable;
+
import org.eclipse.jst.jsf.common.runtime.internal.view.model.common.AbstractTagAttribute;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDAttributeDeclaration;
@@ -17,44 +20,194 @@ public class TLDTagAttribute extends AbstractTagAttribute
*/
private static final long serialVersionUID = 4327701042556836452L;
- private final TLDAttributeDeclaration _decl;
+ private final TLDAttributeData _tldData;
/**
* @param decl
*/
public TLDTagAttribute(final TLDAttributeDeclaration decl)
{
- _decl = decl;
+ _tldData = new DocumentAttributeData(decl);
}
@Override
public String getName()
{
- return _decl.getAttrName();
+ return _tldData.getName();
}
@Override
- public String getTargetNamespace()
+ public String getDisplayName()
{
- return null;
+ return _tldData.getDisplayName();
}
@Override
- public String getDescription()
- {
- return _decl.getDescription();
+ public String getDescription() {
+ return _tldData.getDescription();
}
@Override
- public String getDisplayName()
+ public String getTargetNamespace()
{
- return _decl.getAttrName();
+ return _tldData.getTargetNamespace();
}
- @Override
public boolean isRequired()
{
- return _decl.isRequired();
+ return _tldData.isRequired();
}
+ /**
+ * Diagnostic only. For testing only. Should never be exposed on ITagAttribute.
+ *
+ * @return true if this instance wraps a SerializedTLDAttributeData (the
+ * instance was created by readObject). False if it is wrapping a
+ * TLDAttributeDeclaration.
+ */
+ public boolean hasBeenDeserialized()
+ {
+ return _tldData instanceof SerializedTLDAttributeData;
+ }
+ @Override
+ public String toString()
+ {
+ return String.format("Attribute: name=%s, displayName=%s, description=%s\n" //$NON-NLS-1$
+ , getName(), getDisplayName(), getDescription());
+ }
+
+ private static class DocumentAttributeData extends TLDAttributeData
+ {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -5974753636507938515L;
+ private final TLDAttributeDeclaration _decl;
+
+
+ public DocumentAttributeData(TLDAttributeDeclaration decl)
+ {
+ super();
+ _decl = decl;
+ }
+
+ private Object writeReplace()
+ {
+ return new SerializedTLDAttributeData(getName(), getDisplayName(), getDescription()
+ , getTargetNamespace(), isRequired());
+ }
+
+ @SuppressWarnings("unused")
+ private void readObject(java.io.ObjectInputStream in)
+ throws IOException, ClassNotFoundException
+ {
+ throw new UnsupportedOperationException("This object should be serialized; writeReplace"); //$NON-NLS-1$
+ }
+
+ @Override
+ public String getName()
+ {
+ return _decl.getAttrName();
+ }
+
+ @Override
+ public String getTargetNamespace()
+ {
+ return null;
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return _decl.getDescription();
+ }
+
+ @Override
+ public String getDisplayName()
+ {
+ return _decl.getAttrName();
+ }
+
+ @Override
+ public boolean isRequired()
+ {
+ return _decl.isRequired();
+ }
+
+ }
+
+ /**
+ * @author cbateman
+ *
+ */
+ private static class SerializedTLDAttributeData extends TLDAttributeData
+ {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -1094006883222087189L;
+
+ private final String _name;
+ private final String _displayName;
+ private final String _description;
+ private final String _targetNamespace;
+ private final boolean _isRequired;
+
+
+
+ public SerializedTLDAttributeData(String name, String displayName,
+ String description, String targetNamespace, boolean isRequired)
+ {
+ super();
+ _name = name;
+ _displayName = displayName;
+ _description = description;
+ _targetNamespace = targetNamespace;
+ _isRequired = isRequired;
+ }
+
+ @Override
+ public String getName()
+ {
+ return _name;
+ }
+
+ @Override
+ public String getDisplayName()
+ {
+ return _displayName;
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return _description;
+ }
+
+ @Override
+ public String getTargetNamespace()
+ {
+ return _targetNamespace;
+ }
+
+ @Override
+ public boolean isRequired()
+ {
+ return _isRequired;
+ }
+
+ }
+
+ private static abstract class TLDAttributeData implements Serializable
+ {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 8376571212994363562L;
+ public abstract String getName();
+ public abstract String getDisplayName();
+ public abstract String getDescription();
+ public abstract String getTargetNamespace();
+ public abstract boolean isRequired();
+ }
}

Back to the top