[IoTivity Simulator] Handling resource interfaces.
[platform/upstream/iotivity.git] / service / simulator / java / sdk / src / org / oic / simulator / AttributeValueVisitor.java
index 0d2cea5..8a846a6 100644 (file)
@@ -1,5 +1,25 @@
+/*
+ * Copyright 2015 Samsung Electronics All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.oic.simulator;
 
+/**
+ * This class visits the given attribute value and invokes the right method
+ * based on the type of the attribute value.
+ */
 public class AttributeValueVisitor {
     private AttributeValue  mValue;
     private VisitingMethods mListener;
@@ -46,11 +66,28 @@ public class AttributeValueVisitor {
         public T visitingValue(SimulatorResourceModel[][][] value);
     }
 
+    /**
+     * Constructs {@link AttributeValueVisitor} from the given
+     * {@link AttributeValue} and the implementation of the
+     * {@link VisitingMethods} interface.
+     *
+     * @param value
+     *            {@link AttributeValue} object.
+     * @param listener
+     *            Implementation of {@link VisitingMethods} interface.
+     */
     public AttributeValueVisitor(AttributeValue value, VisitingMethods listener) {
         mValue = value;
         mListener = listener;
     }
 
+    /**
+     * API which processes an {@link AttributeValue} to find its value type and
+     * convert the Object to the appropriate type for invoking the right
+     * visitor(method) in the {@link VisitingMethods} interface.
+     *
+     * @return Object which holds the value returned by the visitor method.
+     */
     public Object visit() {
         if (null == mValue || null == mListener)
             return null;