public interface IListener extends IModelElement, IDescribeable, IDisplayable {
ModelElementType TYPE = new ModelElementType( IListener.class );
// *** Implementation ***
@Type( base = JavaTypeName.class )
@Reference( target = JavaType.class )
@JavaTypeConstraint( kind = JavaTypeKind.CLASS, type = "javax.servlet.ServletContextListener" )
@Label( standard = "Implementation", full = "Listener implementation class" )
@XmlBinding( path = "listener-class" )
@Documentation( content = "The listener implementation class." )
ValueProperty PROP_IMPLEMENTATION = new ValueProperty( TYPE, "Implementation" );
ReferenceValue<JavaTypeName, JavaType> getImplementation();
void setImplementation( String value );
void setImplementation( JavaTypeName value );
So this type of model when a property editor is added for the Implementation property is where I'm having the problem. In the editor when I type in a implementation class name and if it doesn't exist, then I click on the "+" button for create, the file that is created is invalid. Here is the output in my particular case:
import javax.servlet.ServletContextEvent;
// TODO Auto-generated constructor stub
}Listener implements ServletContextListener
public void contextDestroyed(ServletContextEvent arg0) {
// TODO Auto-generated method stub
public void contextInitialized(ServletContextEvent arg0) {
// TODO Auto-generated method stub
As you can see the code is malformed and will not compile. What is strange is that if I go back to the @JavaTypeConstraint(..) annotation and specify another type ="" attribute and use a Class instead of an Interface the "+" create action works as expected. Also if instead use two interface classes instead of one that also works properly. But when I use just one interface class I get this error.
--
Liferay, Inc.