Examples of Encoder


Examples of java.beans.Encoder

    public void testInstantiate_InitialUpperCasePropName() throws Exception {
        String[] props = new String[] { "Prop1", "prop2" };
        MockPersistenceDelegate pd = new MockPersistenceDelegate(props);
        MockBean b = new MockBean();
        b.setAll("bean1", 2);
        Expression e = pd.instantiate(b, new Encoder());
        assertSame(b, e.getValue());
        assertSame(MockBean.class, e.getTarget());
        assertEquals("new", e.getMethodName());
        assertEquals(2, e.getArguments().length);
        assertSame(b.getProp1(), e.getArguments()[0]);
View Full Code Here

Examples of java.beans.Encoder

     */
    public void testInstantiate_NotRegularGetter() throws Exception {
        MockPersistenceDelegate pd = new MockPersistenceDelegate(
                new String[] { "prop" });
        MockFoo2 b = new MockFoo2(2);
        Expression e = pd.instantiate(b, new Encoder());

        assertSame(b, e.getValue());
        assertSame(MockFoo2.class, e.getTarget());
        assertEquals("new", e.getMethodName());
        assertEquals(1, e.getArguments().length);
View Full Code Here

Examples of java.beans.Encoder

        bean1.setValueCalled = false;
        bean2.setValueCalled = false;

        MockPersistenceDelegate mockPersistenceDelegate = new MockPersistenceDelegate();
        mockPersistenceDelegate.initialize(MockBean3.class, bean1, bean2,
                new Encoder());
        assertEquals("bean1", bean1.getValue());
        assertEquals("bean2", bean2.getValue());
        assertFalse(bean1.setValueCalled);
        assertFalse(bean2.setValueCalled);
    }
View Full Code Here

Examples of java.beans.Encoder

    /*
     * Tests initialize() with null class.
     */
    public void testInitialize_NullClass() {
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        Encoder enc = new Encoder();
        Object o1 = new Object();
        Object o2 = new Object();
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        try {
            enc.setExceptionListener(new ExceptionListener() {
                public void exceptionThrown(Exception e) {
                    CallVerificationStack.getInstance().push(e);
                }
            });
            pd.initialize(null, o1, o2, enc);
View Full Code Here

Examples of java.beans.Encoder

    /*
     * Tests initialize() with null old and new instances.
     */
    public void testInitialize_NullInstances() {
        MockPersistenceDelegate pd = new MockPersistenceDelegate();
        Encoder enc = new Encoder();
        MockFoo b = new MockFoo();
        b.setName("myName");
        // enc.setPersistenceDelegate(MockFooStop.class,
        // new MockPersistenceDelegate());
        enc.setExceptionListener(new ExceptionListener() {
            public void exceptionThrown(Exception e) {
                CallVerificationStack.getInstance().push(e);
            }
        });
        try {
View Full Code Here

Examples of java.beans.Encoder

    /*
     * Tests array persistence delegate
     */
    public void testArrayPD_Normal() {
        Encoder enc = new MockEncoder();
        int[] ia = new int[] { 1 };
        PersistenceDelegate pd = enc.getPersistenceDelegate(ia.getClass());
        pd.writeObject(ia, enc);
    }
View Full Code Here

Examples of javax.websocket.Encoder

            String msg = obj.toString();
            sendStringByCompletion(msg, completion);
            return;
        }

        Encoder encoder = findEncoder(obj);

        try {
            if (encoder instanceof Encoder.Text) {
                String msg = ((Encoder.Text) encoder).encode(obj);
                sendStringByCompletion(msg, completion);
View Full Code Here

Examples of javax.websocket.Encoder

    protected void setEncoders(EndpointConfig endpointConfig)
            throws DeploymentException {
        encoderEntries.clear();
        for (Class<? extends Encoder> encoderClazz :
                endpointConfig.getEncoders()) {
            Encoder instance;
            try {
                instance = encoderClazz.newInstance();
                instance.init(endpointConfig);
            } catch (InstantiationException | IllegalAccessException e) {
                throw new DeploymentException(
                        sm.getString("wsRemoteEndpoint.invalidEncoder",
                                encoderClazz.getName()), e);
            }
View Full Code Here

Examples of javax.websocket.Encoder

            throws DeploymentException {

        for (Class<? extends Encoder> encoder : encoders) {
            // Need to instantiate decoder to ensure it is valid and that
            // deployment can be failed if it is not
            @SuppressWarnings("unused")
            Encoder instance;
            try {
                encoder.newInstance();
            } catch(InstantiationException | IllegalAccessException e) {
                throw new DeploymentException(sm.getString(
View Full Code Here

Examples of javax.websocket.Encoder

            String msg = obj.toString();
            sendStringByCompletion(msg, completion);
            return;
        }

        Encoder encoder = findEncoder(obj);

        try {
            if (encoder instanceof Encoder.Text) {
                String msg = ((Encoder.Text) encoder).encode(obj);
                sendStringByCompletion(msg, completion);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.