/*
 * Copyright (c) 2014-2014 Cazcade Limited
 *
 * 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 com.cazcade.dollar;

import org.vertx.java.core.json.JsonObject;

/**
 * @author <a href="http://uk.linkedin.com/in/neilellis">Neil Ellis</a>
 */
class DollarFactory {
    public static $ fromField(Object field) {
        if (field == null) {
            return DollarNull.INSTANCE;
        }
        if (field instanceof String) {
            return new DollarString((String) field);
        }
        if (field instanceof Number) {
            return new DollarNumber((Number) field);
        }
        if (field instanceof JsonObject) {
            return new DollarJson(field);
        }
        return new DollarJson(field.toString());
    }

    public static $ fromValue() {
        return new DollarJson();
    }

    public static $ fromValue(JsonObject json) {
        if (json == null) {
            return DollarNull.INSTANCE;
        }
        return new DollarJson(json);
    }

    public static $ fromValue(String json) {
        if (json == null) {
            return DollarNull.INSTANCE;
        }
        return new DollarJson(json);
    }

    public static $ fromValue(Object o) {
        if (o == null) {
            return DollarNull.INSTANCE;
        }
        return new DollarJson(o);
    }
}

@@ -778,31 +778,24 @@
 ctory %7B%0A    
-public 
 static $ fro
@@ -1247,38 +1247,32 @@
 ());%0A    %7D%0A%0A    
-public
  static $ fromVa
@@ -1275,24 +1275,24 @@
 omValue() %7B%0A
+
         retu
@@ -1315,38 +1315,32 @@
 n();%0A    %7D%0A%0A    
-public
  static $ fromVa
@@ -1480,38 +1480,32 @@
 on);%0A    %7D%0A%0A    
-public
  static $ fromVa
@@ -1649,18 +1649,12 @@
  %7D%0A%0A
+
     
-public
  sta

Support for multiple types including nulls