Package org.codehaus.metaclass.model

Examples of org.codehaus.metaclass.model.Attribute


     * @return true if descriptor represents DNA component
     */
    boolean isDNAComponent( final ClassDescriptor descriptor )
    {
        final Attribute[] attributes = descriptor.getAttributes();
        final Attribute attribute =
            Attributes.getAttributeByName( attributes, "dna.component" );
        return null != attribute;
    }
View Full Code Here


     * @param type the type
     * @param issues the list of issues
     */
    void verifyMetaData( final Class type, final List issues )
    {
        final Attribute attribute =
            Attributes.getAttribute( type, "dna.component" );
        if( null == attribute )
        {
            final String message = getMessage( "CV001" );
            final VerifyIssue issue =
View Full Code Here

     * @param type the type
     * @param issues the list of issues
     */
    void verifyConfigurationMetaData( final Class type, final List issues )
    {
        Attribute attribute = getConfigurationMetaData( type );
        if( null != attribute )
        {
            final String location = attribute.getParameter( "location" );
            if( null == location )
            {
                final Object[] args = new Object[]{"type"};
                final String message = getMessage( "CV019", args );
                final VerifyIssue issue =
View Full Code Here

    void verifyDependencyMetaData( final Class type, final List issues )
    {
        final Attribute[] attributes = getDependencyAttributes( type );
        for( int i = 0; i < attributes.length; i++ )
        {
            final Attribute attribute = attributes[ i ];
            verifyDependencyMetaData( type, attribute, issues );
        }
    }
View Full Code Here

        final Properties good = new Properties();
        good.setProperty( "type", BAD_SERVICE );
        final Attribute[] attributes = new Attribute[]
        {
            new Attribute( "dna.component" ),
            new Attribute( "dna.service", bad ),
            new Attribute( "dna.service", good )
        };
        return new ClassDescriptor( classname,
                                    attributes,
                                    attributes,
                                    FieldDescriptor.EMPTY_SET,
View Full Code Here

    {
        final Properties parameters = new Properties();
        parameters.setProperty( "optional", "false" );
        parameters.setProperty( "type", ActionListener.class.getName() );
        parameters.setProperty( "key", ActionListener.class.getName() );
        final Attribute attribute = new Attribute( "dna.dependency", parameters );
        final Attribute[] attributes = new Attribute[]{attribute};
        final ParameterDescriptor param =
            new ParameterDescriptor("locator", ResourceLocator.class.getName());
        final ParameterDescriptor[] params = new ParameterDescriptor[]{param};
        final MethodDescriptor descriptor =
View Full Code Here

{
    public void testProcessClassAttributeWithoutTransformations()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processClassAttribute( new MockJavaClass(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here

        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Properties parameters = new Properties();
        parameters.setProperty( "type", "X" );
        final Attribute attribute = new Attribute( "dna.service", parameters );
        final Attribute result =
            interceptor.processClassAttribute( new MockJavaClass(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "dna.service", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 1, result.getParameterCount() );
        assertEquals( "attribute.parameter(type)",
                      MockJavaSource.PREFIX + "X", result.getParameter( "type" ) );
    }
View Full Code Here

    public void testProcessClassAttributeWithDNAServiceMissingType()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "dna.service" );
        try
        {
            final MockJavaClass clazz = new MockJavaClass();
            clazz.setName( "Blah" );
            interceptor.processClassAttribute( clazz, attribute );
View Full Code Here

    public void testProcessMethodAttributeWithDNAConfigurationWith()
        throws Exception
    {
        final DNAAttributeInterceptor interceptor = new DNAAttributeInterceptor();
        final Attribute attribute = new Attribute( "ignored" );
        final Attribute result =
            interceptor.processMethodAttribute( new JavaMethod(), attribute );
        assertNotNull( "attribute", result );
        assertEquals( "attribute.name", "ignored", result.getName() );
        assertEquals( "attribute.value", null, result.getValue() );
        assertEquals( "attribute.parameterCount", 0, result.getParameterCount() );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.metaclass.model.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.