Package org.apache.tapestry5.ioc.internal.util

Examples of org.apache.tapestry5.ioc.internal.util.TapestryException


            root(initialParserState);

            return new ComponentTemplateImpl(resource, tokens, componentIds, extension, overrides);
        } catch (Exception ex)
        {
            throw new TapestryException(String.format("Failure parsing template %s: %s", resource,
                    InternalUtils.toMessage(ex)), tokenStream.getLocation(), ex);
        }

    }
View Full Code Here


        String id = getRequiredIdAttribute();

        if (extensionPointIdSet.containsKey(id))
        {
            throw new TapestryException(String.format("Extension point '%s' is already defined for this template. Extension point ids must be unique.", id), getLocation(), null);
        } else
        {
            extensionPointIdSet.put(id, true);
        }
View Full Code Here

        // If provided t:mixins but not t:id or t:type, then its not quite a
        // component

        if (mixins != null && !isComponent)
            throw new TapestryException(ServicesMessages.mixinsInvalidWithoutIdOrType(elementName),
                    location, null);

        if (isComponent)
        {
            tokenAccumulator.add(new StartComponentToken(elementName, id, type, mixins, location));
View Full Code Here

    private void classicParameter(TemplateParserState state)
    {
        String parameterName = getSingleParameter("name");

        if (InternalUtils.isBlank(parameterName))
            throw new TapestryException(ServicesMessages.parameterElementNameRequired(),
                    getLocation(), null);

        ensureParameterWithinComponent(state);

        tokenAccumulator.add(new ParameterToken(parameterName, getLocation()));
View Full Code Here

    private void parameterElement(TemplateParserState state)
    {
        ensureParameterWithinComponent(state);

        if (tokenStream.getAttributeCount() > 0)
            throw new TapestryException(ServicesMessages.parameterElementDoesNotAllowAttributes(),
                    getLocation(), null);

        tokenAccumulator.add(new ParameterToken(tokenStream.getLocalName(), getLocation()));

        processBody(state.insideComponent(false));
View Full Code Here

                continue;
            }

            // Only the named attribute is allowed.

            throw new TapestryException(ServicesMessages.undefinedTapestryAttribute(tokenStream
                    .getLocalName(), qName.toString(), attributeName), getLocation(), null);
        }

        return result;
    }
View Full Code Here

        if (ID_PATTERN.matcher(id).matches())
            return;

        // Not a match.

        throw new TapestryException(ServicesMessages.invalidId(messageKey, id), getLocation(), null);
    }
View Full Code Here

        }
        catch (RuntimeException ex)
        {
            String message = messages.format("block-error", propertyModel.getPropertyName(), dataType, object, ex);

            throw new TapestryException(message, resources.getLocation(), ex);
        }
       
    }
View Full Code Here

            return;

        boolean orderEmpty = annotation.order().length == 0;

        if (!orderEmpty && annotation.order().length != annotation.value().length)
            throw new TapestryException(TransformMessages.badMixinConstraintLength(annotation, field.getName()), model,
                    null);

        for (int i = 0; i < annotation.value().length; i++)
        {
            String[] constraints = orderEmpty ? InternalConstants.EMPTY_STRING_ARRAY : TapestryInternalUtils
View Full Code Here

                            Object boundValue = parameterBinding.get();

                            result = typeCoercer.coerce(boundValue, fieldType);
                        } catch (RuntimeException ex)
                        {
                            throw new TapestryException(String.format(
                                    "Failure reading parameter '%s' of component %s: %s", parameterName,
                                    icr.getCompleteId(), InternalUtils.toMessage(ex)), parameterBinding, ex);
                        }

                        if (result == null && !allowNull)
                        {
                            throw new TapestryException(
                                    String.format(
                                            "Parameter '%s' of component %s is bound to null. This parameter is not allowed to be null.",
                                            parameterName, icr.getCompleteId()), parameterBinding, null);
                        }

                        return result;
                    }

                    private void writeToBinding(Object newValue)
                    {
                        // An unbound parameter acts like a simple field
                        // with no side effects.

                        if (parameterBinding == null)
                        {
                            return;
                        }

                        try
                        {
                            Object coerced = typeCoercer.coerce(newValue, parameterBinding.getBindingType());

                            parameterBinding.set(coerced);
                        } catch (RuntimeException ex)
                        {
                            throw new TapestryException(String.format(
                                    "Failure writing parameter '%s' of component %s: %s", parameterName,
                                    icr.getCompleteId(), InternalUtils.toMessage(ex)), icr, ex);
                        }
                    }
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.internal.util.TapestryException

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.