From d9a64e59adce6d07bbb182bd5ef2dc4dad204572 Mon Sep 17 00:00:00 2001 From: Sergey Vasiliev Date: Thu, 13 Jul 2006 18:08:44 +0400 Subject: [PATCH] 'decorator' pattern for extendClass annotation(instantiation of faces factories) --- dom/impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java | 7 +++++-- dom/openapi/src/com/intellij/util/xml/ExtendClass.java | 5 +++++ resources_eng/src/messages/IdeBundle.properties | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dom/impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/dom/impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java index 26fef6d6b1..f8d387dd9d 100644 --- a/dom/impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java +++ b/dom/impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java @@ -285,7 +285,9 @@ public abstract class DomInvocationHandler implements InvocationHandler, DomElem protected final void addRequiredChildren() { for (final DomChildrenDescription description : myGenericInfo.getChildrenDescriptions()) { if (description instanceof DomAttributeChildDescription) { - if (((DomAttributeChildDescription)description).getAnnotation(Required.class) != null) { + final Required required = description.getAnnotation(Required.class); + + if (required != null && required.value()) { description.getValues(getProxy()).get(0).ensureXmlElementExists(); } } @@ -294,7 +296,8 @@ public abstract class DomInvocationHandler implements InvocationHandler, DomElem List values = null; final int count = childDescription.getCount(); for (int i = 0; i < count; i++) { - if (childDescription.getAnnotation(i, Required.class) != null) { + final Required required = childDescription.getAnnotation(i, Required.class); + if (required != null && required.value()) { if (values == null) { values = description.getValues(getProxy()); } diff --git a/dom/openapi/src/com/intellij/util/xml/ExtendClass.java b/dom/openapi/src/com/intellij/util/xml/ExtendClass.java index f24868681a..e15806b6a0 100644 --- a/dom/openapi/src/com/intellij/util/xml/ExtendClass.java +++ b/dom/openapi/src/com/intellij/util/xml/ExtendClass.java @@ -35,4 +35,9 @@ public @interface ExtendClass { * States that the class should be concrete and have public default constructor. */ boolean instantiatable() default true; + +/** + * States that the class implements "decorator" pattern + */ + boolean canBeDecorator() default false; } diff --git a/resources_eng/src/messages/IdeBundle.properties b/resources_eng/src/messages/IdeBundle.properties index 56886aa736..bd47da8f62 100644 --- a/resources_eng/src/messages/IdeBundle.properties +++ b/resources_eng/src/messages/IdeBundle.properties @@ -1014,6 +1014,7 @@ class.is.not.a.subclass=''{0}'' is not a subclass of ''{1}'' class.is.not.concrete=''{0}'' is not a concrete class class.is.not.public=''{0}'' is not public class.has.no.default.constructor=''{0}'' has no default constructor +class.decorator.or.has.default.constructor=''{0}'' should have default constructor or implement ''Decorator'' pattern model.highlighting.identity={0} with such name already exists model.highlighting.identity.in.other.file={0} with such name already exists in ''{1}'' file -- 2.11.4.GIT