001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     matic
018 */
019package org.nuxeo.ecm.automation.client.model;
020
021import org.nuxeo.ecm.automation.client.OperationRequest;
022
023/**
024 * @author matic
025 * @deprecated in 5.7 (did not work in 5.6 either): pass Object instance directly to the
026 *             {@link OperationRequest#setInput} method.
027 */
028@Deprecated
029public class PrimitiveInput<T> implements OperationInput {
030
031    private static final long serialVersionUID = -6717232462627061723L;
032
033    public PrimitiveInput(T value) {
034        this.value = value;
035        this.type = value.getClass().getSimpleName().toLowerCase();
036    }
037
038    protected final T value;
039
040    protected final String type;
041
042    @Override
043    public boolean isBinary() {
044        return false;
045    }
046
047    @Override
048    public String getInputType() {
049        return type;
050    }
051
052    @Override
053    public String getInputRef() {
054        return String.format("%s:%s", type, value.toString());
055    }
056
057}