Package com.theoryinpractise.halbuilder.api

Examples of com.theoryinpractise.halbuilder.api.RepresentationException


    public Object getValue(String name) {
        if (properties.containsKey(name)) {
            return properties.get(name);
        } else {
            throw new RepresentationException("Resource does not contain " + name);
        }
    }
View Full Code Here


     */
    public <T> T toClass(Class<T> anInterface) {
        if (InterfaceContract.newInterfaceContract(anInterface).isSatisfiedBy(this)) {
            return InterfaceRenderer.newInterfaceRenderer(anInterface).render(this);
        } else {
            throw new RepresentationException("Unable to write representation to " + anInterface.getName());
        }
    }
View Full Code Here

                    break;
                case '<':
                    readerClass = representationReaders.get(new ContentType(HAL_XML));
                    break;
                default:
                    throw new RepresentationException("unrecognized initial character in stream: " + firstChar);
            }
            Constructor<? extends RepresentationReader> readerConstructor = readerClass.getConstructor(RepresentationFactory.class);
            return readerConstructor.newInstance(this).read(bufferedReader);
        } catch (Exception e) {
            throw new RepresentationException(e);
        }
    }
View Full Code Here

        for (Map.Entry<ContentType, Class<? extends RepresentationWriter>> entry : contentRenderers.entrySet()) {
            if (entry.getKey().matches(contentType)) {
                try {
                    return entry.getValue().newInstance();
                } catch (InstantiationException e) {
                    throw new RepresentationException(e);
                } catch (IllegalAccessException e) {
                    throw new RepresentationException(e);
                }
            }
        }

        throw new IllegalArgumentException("Unsupported contentType: " + contentType);
View Full Code Here

                    return returnValue;
                }
            });
            return proxy;
        } else {
            throw new RepresentationException("Unable to write representation to " + anInterface.getName());
        }


    }
View Full Code Here

            MutableRepresentation resource = readResource(rootNode);

            return resource.toImmutableResource();
        } catch (Exception e) {
            throw new RepresentationException(e);
        }

    }
View Full Code Here

    public Object getValue(String name) {
        if (properties.containsKey(name)) {
            return properties.get(name);
        } else {
            throw new RepresentationException("Resource does not contain " + name);
        }
    }
View Full Code Here

     */
    public <T> T toClass(Class<T> anInterface) {
        if (InterfaceContract.newInterfaceContract(anInterface).isSatisfiedBy(this)) {
            return InterfaceRenderer.newInterfaceRenderer(anInterface).render(this);
        } else {
            throw new RepresentationException("Unable to write representation to " + anInterface.getName());
        }
    }
View Full Code Here

                    return returnValue;
                }
            });
            return proxy;
        } else {
            throw new RepresentationException("Unable to write representation to " + anInterface.getName());
        }
    }
View Full Code Here

    public Object getValue(String name) {
        if (properties.containsKey(name)) {
            return properties.get(name);
        } else {
            throw new RepresentationException("Resource does not contain " + name);
        }
    }
View Full Code Here

TOP

Related Classes of com.theoryinpractise.halbuilder.api.RepresentationException

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.