/*
 * Copyright 2017 Netflix, Inc.
 *
 * 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.netflix.spinnaker.orca.pipeline.expressions.whitelisting;

import java.text.SimpleDateFormat;
import java.util.*;
import java.time.LocalDate;

public interface InstantiationTypeRestrictor {
  Set<Class<?>> allowedTypes = Collections.unmodifiableSet(
    new HashSet<>(
      Arrays.asList(
        String.class,
        Date.class,
        Integer.class,
        Long.class,
        Double.class,
        Byte.class,
        SimpleDateFormat.class,
        Math.class,
        Random.class,
        UUID.class,
        Boolean.class,
        LocalDate.class
      )
    )
  );

  static boolean supports(Class<?> type) {
    return allowedTypes.contains(type);
  }
}

@@ -710,14 +710,20 @@
 ava.
-u
 ti
-l.*
+me.Instant
 ;%0Aim
@@ -747,16 +747,74 @@
 calDate;
+%0Aimport java.time.temporal.ChronoUnit;%0Aimport java.util.*;
 %0A%0Apublic
@@ -1221,16 +1221,65 @@
 te.class
+,%0A        Instant.class,%0A        ChronoUnit.class
 %0A      )

add support for Instant.java in spel (#2338)