001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019package org.apache.isis.viewer.restfulobjects.applib.domainobjects;
020
021import org.codehaus.jackson.JsonNode;
022
023/**
024 * Represents the members within the {@link DomainObjectRepresentation}'s <tt>members</tt>
025 * map.
026 * 
027 * <p>
028 * Do not confuse with the subclasses of {@link AbstractObjectMemberRepresentation}, which
029 * are standalone representations in their own right.
030 */
031public class DomainObjectMemberRepresentation extends DomainRepresentation  {
032
033    public DomainObjectMemberRepresentation(final JsonNode jsonNode) {
034        super(jsonNode);
035    }
036
037    /**
038     * Whether this is a <tt>property</tt>, <tt>collection</tt> or <tt>action</tt>.
039     */
040    public String getMemberType() {
041        return getString("memberType");
042    }
043
044    /**
045     * The reason this member cannot be modified (if property or collection) or 
046     * invoked (if action).
047     * 
048     * <p>
049     * If null, then is not disabled.
050     */
051    public String getDisabledReason() {
052        return getString("disabledReason");
053    }
054
055    public String getFormat() {
056        return getString("format");
057    }
058
059    /**
060     * Isis-specific extension; not part of the RO API;
061     */
062    public String getXIsisFormat() {
063        return getString("extensions.x-isis-format");
064    }
065
066}