Package org.apache.isis.core.metamodel.exceptions

Examples of org.apache.isis.core.metamodel.exceptions.MetaModelException


            processMethodContext.removeMethod(choicesMethod);

            final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
            if (facetedMethod.containsDoOpFacet(ActionChoicesFacet.class)) {
                final Class<?> cls = processMethodContext.getCls();
                throw new MetaModelException(cls + " uses both old and new choices syntax - must use one or other");
            }

            // add facets directly to parameters, not to actions
            final FacetedMethodParameter paramAsHolder = parameters.get(i);
            FacetUtil.addFacet(new ActionParameterChoicesFacetViaMethod(choicesMethod, arrayOfParamType, paramAsHolder, getSpecificationLoader(), getAdapterManager()));
View Full Code Here


            names = (String[]) MethodExtensions.invokeStatic(namesMethod, new Object[0]);
        } catch (final ClassCastException ex) {
            // ignore
        }
        if (names == null || names.length != numElementsRequired) {
            throw new MetaModelException(namesMethod + " must return an String[] array of same size as number of parameters of action");
        }
        return names;
    }
View Full Code Here

            descriptions = (String[]) MethodExtensions.invokeStatic(descriptionMethod, new Object[0]);
        } catch (final ClassCastException ex) {
            // ignore
        }
        if (descriptions == null || descriptions.length != numElementsRequired) {
            throw new MetaModelException(descriptionMethod + " must return an String[] array of same size as number of parameters of action");
        }
        return descriptions;
    }
View Full Code Here

            optionals = (boolean[]) MethodExtensions.invokeStatic(optionalMethod, new Object[0]);
        } catch (final ClassCastException ex) {
            // ignore, test below
        }
        if (optionals == null || optionals.length != numElementsRequired) {
            throw new MetaModelException(optionalMethod + " must return an boolean[] array of same size as number of parameters of action");
        }
        return optionals;
    }
View Full Code Here

    private static void invokeMethod(final Method method, final Object target, final Object[] parameters) {
        try {
            method.invoke(target, parameters);
        } catch (final SecurityException e) {
            throw new MetaModelException(String.format("Cannot access the %s method in %s", method.getName(), target.getClass().getName()));
        } catch (final IllegalArgumentException e1) {
            throw new MetaModelException(e1);
        } catch (final IllegalAccessException e1) {
            throw new MetaModelException(String.format("Cannot access the %s method in %s", method.getName(), target.getClass().getName()));
        } catch (final InvocationTargetException e) {
            final Throwable targetException = e.getTargetException();
            if (targetException instanceof RuntimeException) {
                throw (RuntimeException) targetException;
            } else {
                throw new MetaModelException(targetException);
            }
        }
    }
View Full Code Here

        }
    }

    private static void ensureDecoratorMetContract(final FacetDecorator facetDecorator, final Facet decoratingFacet, final Class<? extends Facet> facetType, final FacetHolder originalFacetHolder) {
        if (decoratingFacet.facetType() != facetType) {
            throw new MetaModelException(MessageFormat.format("Problem with facet decorator '{0}'; inconsistent decorating facetType() for {1}; was {2} but expectected facetType() of {3}", facetDecorator.getClass().getName(), decoratingFacet.getClass().getName(), decoratingFacet.facetType()
                    .getName(), facetType.getName()));
        }
        final Facet facetForFacetType = originalFacetHolder.getFacet(decoratingFacet.facetType());
        if (facetForFacetType != decoratingFacet) {
            throw new MetaModelException(MessageFormat.format("Problem with facet decorator '{0}'; has not replaced original facet for facetType() of {1}", facetDecorator.getClass().getName(), facetType.getName()));
        }
    }
View Full Code Here

            name = (String) InvokeUtils.invokeStatic(nameMethod);
        } catch (final ClassCastException e) {
            // ignore
        }
        if (name == null) {
            throw new MetaModelException("method " + nameMethod + "must return a string");
        }
        return name;
    }
View Full Code Here

            optionals = (boolean[]) InvokeUtils.invokeStatic(optionalMethod, new Object[0]);
        } catch (final ClassCastException ex) {
            // ignore, test below
        }
        if (optionals == null || optionals.length != numElementsRequired) {
            throw new MetaModelException(optionalMethod + " must return an boolean[] array of same size as number of parameters of action");
        }
        return optionals;
    }
View Full Code Here

            names = (String[]) InvokeUtils.invokeStatic(namesMethod, new Object[0]);
        } catch (final ClassCastException ex) {
            // ignore
        }
        if (names == null || names.length != numElementsRequired) {
            throw new MetaModelException(namesMethod + " must return an String[] array of same size as number of parameters of action");
        }
        return names;
    }
View Full Code Here

            processMethodContext.removeMethod(choicesMethod);

            final FacetedMethod facetedMethod = processMethodContext.getFacetHolder();
            if (facetedMethod.containsDoOpFacet(ActionChoicesFacet.class)) {
                final Class<?> cls = processMethodContext.getCls();
                throw new MetaModelException(cls + " uses both old and new choices syntax - must use one or other");
            }

            // add facets directly to parameters, not to actions
            final FacetedMethodParameter paramAsHolder = parameters.get(i);
            FacetUtil.addFacet(new ActionParameterChoicesFacetViaMethod(choicesMethod, arrayOfParamType, paramAsHolder, getSpecificationLookup(), getAdapterMap()));
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.exceptions.MetaModelException

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.