Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 Red Hat, Inc. Distributed under license by Red Hat, Inc. All rights reserved. This program is made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Red Hat, Inc. - initial API and implementation /
package com.openshift.express.internal.client.request.marshalling;

Author(s):
André Dietisheim
public abstract class AbstractJsonMarshaller<REQUEST extends AbstractOpenShiftRequestimplements
	public String marshall(REQUEST requestthrows OpenShiftException {
		ModelNode node = new ModelNode();
		if (request.getRhLogin() != null && request.getRhLogin().length() > 0)
		setJsonDataProperties(noderequest);
		return node.toJSONString(true);
	}
	protected void setJsonDataProperties(ModelNode node, REQUEST requestthrows OpenShiftException {
		// empty default implementation
	}
	protected void setStringProperty(String propertyNameObject valueModelNode node) {
		if (!(value instanceof String)
				&& !isSet((Stringvalue)) {
			return;
		}
		setStringProperty((StringvaluepropertyNamenode);
	}
	protected void setStringProperty(String propertyNameString valueModelNode node) {
		if (!isSet(value)) {
			return;
		}
		node.get(propertyName).set(value);
	}
	protected boolean isSet(String value) {
		return value != null
				&& value.length() > 0;
	}
	protected boolean isSet(Object value) {
		return value != null;
	}
New to GrepCode? Check out our FAQ X